Your first code use the variables and assignment d = a and b and c just as expression there, so run the code:
int main(int argc, char const *argv[])
{
int a =5,b=5,c=7;
int d;
d = a,b,c+1;
printf("%d",d);
return 0;
}
You get 5, b and c+1 just valued and put them there useless.But if you run this code which includes comma expression:
int main(int argc, char const *argv[])
{
int a =5,b=5,c=7;
int d;
d = (a,b,c+1);
printf("%d",d);
return 0;
}
You get 8 as the last one valued expression.
You can use the number play as an expression with ():
int main(int argc, char const *argv[])
{
int a =5,b=5,c=7;
int d;
d = (0,3,1);
printf("%d",d);
return 0;
}
get the last number or valued data.
It works for me the code below:
int main(int argc, char const *argv[])
{
int a =5,b=5,c=7;
int d;
d = 0,3+1,1-1;
printf("%d",d);
return 0;
}
it output is 0, but if you don't with (), it meaningless by this way, why not just use d = 0;