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.

πάντα ῥεῖ
  • 85,314
  • 13
  • 111
  • 183
Anant Mathur
  • 13
  • 1
  • 8

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
  • 227,678
  • 33
  • 352
  • 470