Multiple choice

What will be the output of following program? #include <cstdlib> #include <iostream> using namespace std; int main() { int p; p = 1,2,3; printf(%d,p); system(PAUSE);
return 0;

  1. 1

  2. 2

  3. 3

  4. garbage value

  5. compile error

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The operands to comma operator are evaluated from left to right and we also know that assignment operator takes precedence over comma operator so first x=1 is evaluated and then x =2,3 is evaluated. Hence output would be 1