#include <stdio.h>
int main(void)
{
int a=1,*p=&a,*q=p;
printf("%p %p",p,q);
return 0;
}
I have a doubt in the above code. There are two pointers p and q .when i print the address of p and q it comes out to be same. how is this possible. I know that both are pointing to same location but still they are two different variables then address corresponding to them sud also be different then how come they have same address??
int main(void)
{
int a=1,*p=&a,*q=p;
printf("%p %p",p,q);
return 0;
}
I have a doubt in the above code. There are two pointers p and q .when i print the address of p and q it comes out to be same. how is this possible. I know that both are pointing to same location but still they are two different variables then address corresponding to them sud also be different then how come they have same address??
Comment