Assigment in argument list | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Assigment in argument list

why is the following result y=10 not y=30. is the assigment redirected to non existing y argument and ignored? using namespace std; int main() { int y=10, x=0; cout<<sizeof(y=y+20)<<endl; cout<<y; return 0; }

5th Apr 2018, 6:54 AM
Zdravko
Zdravko - avatar
1 Answer
+ 2
sizeof(expression) doesn't evaluate expression. It's so that you can do sizeof(function()) without causing side effects.
5th Apr 2018, 10:13 AM
Timon Paßlick