+ 2
Why x is 10, but isn't 30?
10 RĂ©ponses
+ 4
That's because operand inside the sizeof operator is not evaluated.It's evaluated only if operand is variable length array.
+ 2
Seems the `sizeof` operator doesn't process the expression `x = x + 20`, it only checks for and return the size (in bytes) of the data type of the operand given, which can also be a variable (still, the type is used for checking). I guess that's why <x> value isn't getting modified : )
+ 2
UraL because sizeof operator only wants to determine size of it's operand type (like int or float) so the expression is not important. But when we have a variable length array, we can determine it's size only after operand evaluation. note that sizeof return same value for 10 and 30. but not same for {1} and {1,2}.
+ 2
Expression inside sizeof operator is not evaluated, if you try to print the the value store inside 's' it print size of data type integer i. e 4
court<<s; //4
+ 1
sizeof() returns the byte size of the value in the parentheses, and the byte size of an int is 10. If you put a random integer in there it will still give you 10. I don't know exactly why x is 10, but I can only guess that sizeof() converts the int to a byte.
+ 1
Because you have not use of size function properly, make it senseful.
+ 1
Kilowac sizeof(int) is 4 !!!
+ 1
Qasem why so?
+ 1
UraL i have no idea then
+ 1
Sizeof() function returns the size of variable in it
In ur case althogh function contain the expression it is not considered as it is referred only as parameter....
So previous value is printed