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.
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.
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.