1,028 views

1 Answer

Best answer
5 votes
5 votes

let assume pointer size is 8 byte

character size is 1 byte

4.      **c++       // ++ and * both are uniary opreator have R to L associativity and  c++ is post increment after that line now c point     to next memory location ie.8008 as indicated with red.

5.       printf ("%s", *++*++c);  

++c is pre increment so now c points to 8016 as indicate with green

so it prints 3000 location onwards ie. "bacha"

6.        printf ("%s", *++*c+2);

// here c is poining to 8016

so it prints 4002 onward ie "acha"

7.        printf ("%c", *++**++c+2);

// here c is poining to 8016

add 2 in the ASCII value of "a" (ascii value of a is  97 and after adding 2 this will be 99)  and 99 is the ASCII value of character "c".

so it print c

selected by

Related questions

2 votes
2 votes
1 answer
3
0 votes
0 votes
1 answer
4
Psnjit asked Jan 12, 2019
1,136 views
main(){unsigned int i= 255;char *p= &i;int j= *p;printf("%d\n", j);unsigned int k= *p;printf("%d", k);} Both the outputs are -1. I have even tried with - int i = 255(3rd ...