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
Join The Discussion
Comments ( 2 )
Related Questions on Pointer
In C, what is a pointer primarily used for?
A. Decision making
B. Code organization
C. Variable declaration
D. Storing values
In C, how do you declare a pointer variable that can store the address of an integer?
A. int *ptr;
B. ptr int;
C. int ptr;
D. ptr *int;
What is the purpose of the '->' operator in C when used with pointers?
A. Arithmetic operation
B. Indirection operator
C. Member access operator
D. Bitwise operation
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