0 0 votes Suppose this code was given i tested using runing the code in compiler but i dont trust the compiler sir can u explain me little bit in depth ::#include <stdio.h>struct ournode {char x,y,z;};int main(){struct ournode p={'1','0','a'+2};struct ournode *q=&p;printf("%c",*(short *)q);printf("%c",*((short *)q+1));return 0;} Programming in C + – saket jaiswal 520 views answer comment Share Follow Print See all 6 Comments 6 6 Comments reply Show 3 previous comments Shaik Masthan commented Jan 10, 2025 reply Follow flag @mv_ind, That was correct.Just a correction: structure instead of array. Remaining is correct only. 1 1 replyShare saket jaiswal commented Jan 10, 2025 reply Follow flag sir but a pointer can point to an unknown memory location thats fine but when we try to accees it it may lead to runtime error then sir how it correct lets assume it is little endian: for first printf printf("%c",*(short *)q); i know we can extract the bytes since its inside the struct but for second printf printf("%c",*((short *)q+1)); the pointer respresentation get out of known memory location then how can we access it should'nt it may lead to runtime error 0 0 replyShare Shaik Masthan commented Jan 10, 2025 reply Follow flag I mean that output depends upon little endian or big endian machine. One is provide output where other may throw runtime error. 1 1 replyShare Please log in or register to add a comment.