int a=0;
int b=1;
int c=a,b;
int d=(a,b);
int a=0; int b=1; int c=a,b; int d=(a,b);
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Outside of an initialization, the comma in
a,bis the comma operator, and evaluates tob. The parentheses in the line involvingdmakes this such a case. So that line is really just equivalent to:However, in the line involving
c, this is not a use of the comma operator. Instead, it’s just a list of variable definitions, equivalent to:(Which consequently will not compile, due to redefinition of
b!)