Possible Duplicate:
C++ Comma Operator
I had been looked if statement in C Language. like this.
if (a, b, c, d) {
blablabla..
blablabla..
}
What’s the meaning of this if statement ?
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.
What you have there is an example of the comma operator. It evaluates all four expressions but uses
dfor theifstatement.Unless the expressions other than
dhave side effects (likea++for example) they’re useless. You can see it in operation with the mini-program:which outputs:
Most people use this without even realising it, as in:
The
i = 0,j = 100,i++andj++are components of two full expressions each of which uses the comma operator.The relevant part of the standard is
C11 6.5.17 Comma operator: