I was referring to NULL Pointer in What's the difference between a null pointer and a void pointer? According to the post reply by @AnT, "Formally, each specific pointer type (int *, char * etc.) has its own dedicated null-pointer value"
I wrote simple program. But the pointer value is not fixed for integer or character. It changes sometimes. So how can we conclude that NULL pointer to int has a fixed value? Also the value of pointer is never 0.
#include <stdio.h>
int main()
{
int a;
char *ptr; // Declaring a pointer without initializing it
int *ptrToInt;
if(ptr)
{
printf("Pointer is not NULL\n");
printf("Value of pointer = %x\n",ptr);
printf("Value of pointer = %x\n",ptrToInt);
}
else
{
printf("Pointer is NULL\n");
printf("Value of pointer = %x",ptr);
printf("Value of pointer = %x\n",ptrToInt);
}
return 0;
}