I am trying following C code. I my opinion output of this code should be 0 0 0 0. But after executing it output comes as 0 -1 -1 0. Can anybody explain how output comes.
#include<iostream>
using namespace std;
int main()
{
int x=-1, y=-1, z=-1;
int w= ++x && ++y && ++z;
cout<<x<<" "<<y<<" "<<z<<" "<<w<<endl;
return 0;
}