Programming Languages
C
Objective
Mar 08, 2013
What will be the output of following statements ?
char x[ ] = "hello hi"; printf("%d%d",sizeof(*x),sizeof(x));
Detailed Explanation
char x[ ] = "hello hi"; printf("%d%d",sizeof(*x),sizeof(x));
"sizeof" displays the number of bytes occupied by an entity in the memory.
sizeof(*x) = 1 byte ( size of 'h' is one byte)
sizeof(x) = 9 bytes ( 'h' 'e' 'l' 'l' 'o' ' ' 'h' 'i' '\0' )
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts