Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Well, each char is 1 byte, and you asked it to calculate the size of two chars
-
pranit1648y@TheBardAbaddon as per your answer it needs to show 1byte,1byte,1byte... Total 5bytes
But in actual it shows output as 2byte.🤔🤔 Plz explain? -
pranit1648y@filthyranter actually For clear visibility , I was uploaded photo of notepad program...
-
pranit1648y@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); ""
-
pranit1648y@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?
-
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.
What is the output of these program?
Actually it show 2byte but I didn't get that how it calculates 2byte?
undefined