Wild Pointer in C++ language
Wild pointer are pointers that have not been initialized and can make a program crash or behave oddly. This is due to the fact that in the C++ programming language, pointers that are not specifically initialized point to unpredictable address in memory.
Write a C++ program in which use of wild pointer are demonstrated.
#include<iostream>
using namespace std;
int main()
{
int *ptr ;
cout<<"Address on ptr is : "<< ptr;
cout<<endl;
cout<<"Value of address that is on ptr is : "<< *ptr;
return 0;
}
Explanation
The above program output is tested on www.jdoodle.com
Output:
Address on ptr is : 0x563a1ceceadc
Value of address that is on ptr is : -443987883
Thanks
Mukesh Rajput
Post A Comment:
0 comments: