Sail E0 Webinar
Question

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;
}
Options:
A .  5 Address
B .  Address Address
C .  Address 5
D .  Compilation error
E .  None of the above
Answer: Option B

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 ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers