It returns the size of the return type from this function ( 4 in my implementation since int used for me), which you will find if you run it as it is, and then change the return type to char (at that moment it will give you 1 ).
The relevant part of the C99 standard is 6.5.3.4.The sizeof operator :
The sizeof operator gives the size (in bytes) of its operand, which can be an expression or a type name enclosed in brackets. Size is determined by the type of operand. The result is an integer. If the operand type is an array type of variable length, then the operand is evaluated; , then the operand is not evaluated , and the result is an integer constant.
Keep in mind this bold bit, this means that the function itself is not called (therefore, printf is not executed inside it). In other words, the output is just the size of your int type (followed by, of course, a new line).
paxdiablo
source share