In this comma-separated expression. Why doesn't the x gets value an instead of b?
int main() {
int a=20;
int b=100;
int x;
x=(a,b);
cout<<x;
}
Gives output: 100
In this comma-separated expression. Why doesn't the x gets value an instead of b?
int main() {
int a=20;
int b=100;
int x;
x=(a,b);
cout<<x;
}
Gives output: 100
The comma operator evaluates the left hand side, discards it, evaluates the right hand side, returns it.