+ 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?

30th Jul 2021, 9:44 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
1 Réponse
+ 3
ptr2 is an undefined constant that cannot be changed. Debug: int* ptr2; int b = 56; ptr2 = &b; printf(%d", *ptr2);
30th Jul 2021, 9:56 AM
Solo
Solo - avatar
Aujourd'hui en vedette
.
1 Votes
What?
0 Votes
HTML
0 Votes
FRC Coding?
1 Votes
Quiz duel
0 Votes
AI
2 Votes
help
0 Votes
APIs
1 Votes
Create Agent
0 Votes