The operands to the comma operator are evaluated from left to right. The value of the left hand expression is discarded. The type and value of the result are the type type and value of the right hand operand. Note: assignment takes precedence over the comma operator, so in this case x=1 is evaluated first; than x, 2, 3
int main(int argc, char** argv)
x = 1, 2, 3;
std::cout << x << std::endl;
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.