0

I was practicing practicing some programming and by mistake wrote the following line of code :

int a,b;
cin>>a,b;

Can anybody explain what the comma does here and why doesn't the compiler show any error.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
Anant Mathur
  • 13
  • 1
  • 10

1 Answers1

1

It means that the whole expression has the value b.

But because b is not initialised the behaviour of your code is undefined!

Modern compilers can warm you of this.

Bathsheba
  • 231,907
  • 34
  • 361
  • 483