What is the output of the following code? Char*a="Coding"; char*b=(++a) +3; printf("%c", *b) ; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the output of the following code? Char*a="Coding"; char*b=(++a) +3; printf("%c", *b) ;

Explain the answer.

22nd Jun 2020, 7:34 AM
Kiruthika U
Kiruthika U - avatar
2 Answers
+ 3
About "What is the output" ... You can test run the code in Playground. As for the explanation ... char *a = "Coding"; char *b = (++a) + 3; // ++a adjusts pointer <a> to point to the next char, so <a> by now points to "oding" // (++a) + 3 sets pointer <b> to point to the fourth char after initial address pointed by <a>, so <b> points to "ng" printf("%c", *b); // <b> is "ng", *b is 'n' (the value at that address)
22nd Jun 2020, 8:17 AM
Ipang
0
n
16th Jan 2022, 8:26 AM
Jayasri dhara