Basic of pointer...

#include<conio.h>
#include<stdio.h>

void main()
{
int x=10,*p;
p=&x;
printf("%d",&p);
printf("\n%d",*p);
printf("\n%p",p);
printf("\n%p",&p);
getch();
}

Why output looks like this.....

Output = -12
Output = -14
Output = FFF4
Output = FFF2
Last edited on
That's interesting because I compiled and ran the same program and my output was:

3669076
10
0037FC60
0037FC54


compiler maybe?

EDIT: btw the output may vary, but the last number should be equal to the first number converted into hex, and the second number should always be 10
Last edited on
Topic archived. No new replies allowed.