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));

Choose the correct answer:
A) 18
B) 19
C) 29
D) 09
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
Feedback