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

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -