What is the output of the following program#includevoid main(){printf("%d%d",sizeof('a'),sizeof("a"));

Questions by msonia0710   answers by msonia0710

Showing Answers 1 - 3 of 3 Answers

malaram

  • Jan 31st, 2007
 

The output of following program is:22(i) 'a' is a character constant but compiler take the ASCII value of 'a' and ASCII value is an integer value so answer of sizeof('a') is 2(ii)"a" is a string constant and it is single character but compiler also count NULL() as character so total characters are two thats why answer of sizeof("a") is also 2

malaram

  • Jan 31st, 2007
 

output is: 22for sizeof('a') compiler takes the ASCII value of 'a' and ASCII value is integer so answer is 2for sizeof("a") compiler also count NULL() so total characters are 2 hence answer is 2

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.