mardi 17 août 2021

Trouble in differentiating the Comma operator vs comma separator

I am having trouble differentiating comma as operator or separator. Have gone through various questions but none explains when the comma acts a operator vs when it acts as separator. The answers just say here it acts as operator and there it acts as separator. My question is HOW CAN I SAY LOOKING AT A STATEMENT that when comma is a operator and when is it a separator. Historically i understand that operator needs operands and comma is usually a separator. But how it transforms into operator is confusing me.

int a;
a = 1, 2, 3;
printf("%d", a);

int a = 1, 2, 3;
printf("%d", a);

Aucun commentaire:

Enregistrer un commentaire