Printing the value of a pointer in C -
int main() { int *i,*j; printf("%u",i); }
the above program result in output 0
int main() { int *i,*j; j=i; printf("%u",i); }
but
the above program result in non zero. why?
both pointers not initialized initial value indeterminate. accessing uninitialized pointer undefined behavior.
moreover use p
conversion specifier print pointer value (and yes cast required) u
requires unsigned int
argument :
printf("%p\n", (void *) i);
Comments
Post a Comment