can the Pointer have value?? so In which case is it used
int num=100;
int* iptr=NULL;
iptr=reinterpret_cast<int*>(num);
printf("%d \n",num);
printf("%d \n",num);
result 100 100
can the Pointer have value?? so In which case is it used
int num=100;
int* iptr=NULL;
iptr=reinterpret_cast<int*>(num);
printf("%d \n",num);
printf("%d \n",num);
result 100 100
reinterpret_cast
will not be a safely-derived pointer value except under certain conditions. Those conditions are not met in your example.Citation from CPP draft (N4713):
The conditions for Safely-derived pointers.