3

What is the output of these program?

Actually it show 2byte but I didn't get that how it calculates 2byte?

Comments
  • 3
    Well, each char is 1 byte, and you asked it to calculate the size of two chars
  • 0
    @TheBardAbaddon as per your answer it needs to show 1byte,1byte,1byte... Total 5bytes

    But in actual it shows output as 2byte.🤔🤔 Plz explain?
  • 1
    @filthyranter actually For clear visibility , I was uploaded photo of notepad program...
  • 0
    @alwaysmpe just assume there is no returns statement in above program , then also it show same output for "" size of(a+b+c+d+e); ""
  • 0
    @alwaysmpe I just want to know that if i write "sizeof(a)" then I got output as 1 but when I write "sizeof(a+a)" then it shows output as 2 Why?
  • 0
    @alwaysmpe thanks
  • 3
    Because although a and a are each of type char, the expression a + a is of type int. So is a + b + c + d + e. Anytime you do math with char types, they are converted to int before doing the actual calculations.
  • 0
    @alwaysmpe thank you
Add Comment