Plz explain how output is 12 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Plz explain how output is 12

#include<stdio.h> int main() { int a=90; int *p1=&a; *p1=11; (*p1)++; printf("%d",a); return 0; }

1st May 2020, 7:49 PM
Kawser
Kawser - avatar
1 Answer
+ 3
*p is a pointer on variable (a). So when u asign 11 to *p that mean the value of variable (a) changes to 11. Also if u increment *p the value of variable (a) will increment to 12.
1st May 2020, 8:08 PM
Youssef Radid
Youssef Radid - avatar