How I can check if a variable is initialized?

Hello,
I have a question,
If I have a variable, such as a pointer, but I don't know if it is initialized. Is there any method to check this?
For example, it likes
1
2
3
4
5
int *ptr;
if (isInitializedPointer(ptr))
   std::cout << "The pointer is available to use" << std::endl;
else
   std::cout << "The pointer is not already initialized" << std::endl;

Thanks for your helps!
I dont think any function is available to check .....
You should initialize it when you use it the first time.

just like:

 
int* ptr = 0;


But, isInitializedPointer(ptr) is useless in C++, you can get the value of ptr.

You can not get the initialized mark of it, there is no records, only if you mark it yourself.
Topic archived. No new replies allowed.