Question
#include<stdio.h>
int main()
{
int i = 5;
int *p;
p = &i;
printf("%u %u",*&p, &*p);
return 0;
}
What will be output of following program?
#include<stdio.h>
int main()
{
int i = 5;
int *p;
p = &i;
printf("%u %u",*&p, &*p);
return 0;
}
Answer: Option B
&*p = &*(&i) //since p = &i
Was this answer helpful ?
Since * and & always cancel to each other.
i.e. *&a = a
so *&p = p which store address of integer i
&*p = &*(&i) //since p = &i
= &(*&i)
= &i
So second output is also address of i
Was this answer helpful ?
Submit Solution