What will be the output of the following program code?
#include <stdio.h>
void main()
{
int i=3, *j, **k;
j = &i;
k = &j;
printf("%d%d%d", *j, **k, *(*k));
}
#include <stdio.h>
void main()
{
int i=3, *j, **k;
j = &i;
k = &j;
printf("%d%d%d", *j, **k, *(*k));
}
A. 444
B. 000
C. 333
D. 433
E. Garbage Value
Answer: Option C
Suppose here we take address of i=1000 , j=2000, k=3000.
j=&i ; i.e. j=1000 i.e. *j = *(1000) --> *j=(3);
k=&j i.e. k=2000 i.e. *k = *(2000)
*k = *(1000)
*k = (3);
Hence Output is i=3 , j=3 ,k=3.
solution: *j==i aur,
**k means *j and *j mean i.
aur *(*k)means*j and *j means I
then,
333 ans
*j means i