Can anyone explain why the output of the following code snippet is coming like that | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone explain why the output of the following code snippet is coming like that

#include <stdio.h> struct Ournode{ char x, y, z; }; int main() { struct Ournode p = {'1', '0', 'a' + 2}; struct Ournode *q = &p; printf ("%c, %c", *((char*)q+1), *((char*)q+2)); return 0; } It giving output as 0, c why not it gives as '0', 'c'

17th Oct 2019, 6:15 AM
Preity
Preity - avatar
1 Answer
0
~ swim ~ can you help in this? how the output is coming 0, c explain that too please
17th Oct 2019, 6:16 AM
Preity
Preity - avatar