+ 3
Constant Pointer Error in C
//ok int a=5; int* const ptr=&a; printf("%d ", *ptr); //Error int* const ptr2; int b=56; ptr2= &b; printf("%d ", *ptr2); Why the second part produces error as the output?
1 Réponse
+ 3
ptr2 is an undefined constant that cannot be changed.
Debug:
int* ptr2;
int b = 56;
ptr2 = &b;
printf(%d", *ptr2);