I know that expressions like x++
or function calls don't get evaluated in the sizeof operator.
When I ran the below code, I got 4 8 8
as output.
Can somebody explain to me what is actually happening on lines 6,7,8?
#include <stdio.h>
int main()
{
int x=10;
double y=10.0;
printf("%d ",sizeof (x=x+y));
printf("%d ",sizeof (y=x+y));
printf("%d ",sizeof (x+y));
return 0;
}
I figured out that if an expression contains an assignment operator =
implicitly (like pre-increment) or explicitly (like x=x+y
) , then the expression doesn't get evaluated in the sizeof
operator.
Am I right?