c++ - How does the Comma Operator work -


how comma operator work in c++?

for instance, if do:

a = b, c;   

does end equaling b or c?

(yes, know easy test - documenting on here find answer quickly.)

update: question has exposed nuance when using comma operator. document this:

a = b, c;    // set value of b!  = (b, c);  // set value of c! 

this question inspired typo in code. intended be

a = b; c = d; 

turned into

a = b,    //  <-  note comma typo! c = d; 

it equal b.

the comma operator has lower precedence assignment.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -