0
int a=3,1; 
int b=(5,4);

I am a beginner in c and I noticed in a book this type of initialization . what does this initialisation mean?

Boyka
  • 138
  • 9
  • `int a=3,1;` is not even valid C code, since `=` has higher precedence than `,`. – Lundin Jan 26 '16 at 10:54
  • [What does the comma operator `,` do in C?](http://stackoverflow.com/questions/52550/what-does-the-comma-operator-do-in-c). – Lundin Jan 26 '16 at 10:56

1 Answers1

0

int b = (5,4) will first evaluate 5 then 4. The last thing that is evaluated will be assigned to the variable. For example

int b = (5,4,3,2,1)

in this case the value of b will be 1.

Claudio Cortese
  • 1,372
  • 2
  • 10
  • 21