0

What is the output!.

#include <stdio.h> void main() { int k = 5; int *p = &k; int **m = &p; printf("%d%d%d\n", k, *p, **p); }

27th Aug 2018, 7:00 PM
athik
6 Respostas
+ 7
athik rehman First of all you need to know this (*) - Dereference Operator (&) - Reference/Address Operator int k = 5 // 'k' is assigned the value 5 int *p = &k // a pointer variable 'p' is created which holds the address of variable 'k' //p = &k, k = 5 //*p = 5 int **m = &p // a double pointer variable is created which holds the address of pointer variable 'p'. The pointer variable 'p' holds the address of 'k' //m = &p, p = &k, k = 5 //**m = 5
27th Aug 2018, 10:19 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 6
athik rehman Corrected the code, guess the output and then check if your guess is correct or not. #include <stdio.h> int main() { int k = 5; int *p = &k; int **m = &p; printf("%d%d%d\n", k, *p, **m); }
27th Aug 2018, 9:18 PM
blACk sh4d0w
blACk sh4d0w - avatar
0
Why don't you run it?
27th Aug 2018, 7:12 PM
Paul Grasser
Paul Grasser - avatar
0
k, the address of k, and the address where the address of k is stored.
27th Aug 2018, 7:19 PM
Bebida Roja
Bebida Roja - avatar
0
but i got compile time error cant understand how?
27th Aug 2018, 7:47 PM
athik
0
nAutAxH AhmAd can u pls explain once! thanks
27th Aug 2018, 9:23 PM
athik