assignment inside sizeof function in c
c, sizeof
Solution
`sizeof` is an operator not a function. Operand of `sizeof` is not evaluated except when it is a variable length array.
C11: 6.5.3.4 p(2):
The `sizeof` operator yields the size (in bytes) of its operand, which may be an expression or the parenthesized name of a type. The size is determined from the type of the operand. The result is an integer. If the type of the operand is a variable length array type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an integer constant.
Problem
``` foo(a = b+c); //new value of a(after the call) = b+c //but sizeof(a = b+c); //new value of a = old value of a ``` Why isn't the the result of the assignment statement reflected in the stack of the function( which contains the above code) in the latter case?