- 1
What is the output of this code, please explain why also
#include<stdio.h> int main(){ int i= 10; int *p=&i; printf("%d\n", *p++); }
3 Answers
+ 1
First of all what you do is declare a variable i = 10 and a pointer p pointing to the address in memory of i. If you print the pointer p you will see that what prints is a hexadecimal number is a location in memory of i. Then what you do by adding ap before the sign * you are indicating that you want to access the value located in the memory location of I. There is one important thing and that is that * pointer is simply a syntax that the language uses to understand that it is a pointer.
+ 1
If there is any wrong word or phrase forgive me, lean on google translate
- 1
Thank u