lundi 10 février 2020

Comma operator and initialisation/assignment [duplicate]

#include <stdio.h>

int main(void) {
    int x;
    x=(1,2,3);   //using (,)
    printf("%d",x);
    return 0;
}

in above code I get output 3. Can anyone explain what is happening? If i remove the (,) the output is 1(obvious).

Aucun commentaire:

Enregistrer un commentaire