-2

What exactly is this called in C?

If I have int x = 3 * (4, 5);

I end up with 15.

Can someone give explanation?

Is this a list where the result is just the first number times the last one?

Thanks

1 Answers1

4

In the C and C++ programming languages, the comma operator (represented by the token ,) is a binary operator that evaluates its first operand and discards the result, and then evaluates the second operand and returns this value (and type).

https://en.wikipedia.org/wiki/Comma_operator

So, the result of the (4, 5) expression will be 5.

mihai
  • 4,592
  • 3
  • 29
  • 42