vendredi 8 mai 2015

C syntax: return with two comma separated values [duplicate]

This question already has an answer here:

I tried this code (in ideone)

#include <stdio.h>

int function()
{
  return (111, 222);
}

int main(void)
{
  printf(">>%d\n", function());
  return 0;
}

and suprisingly it compiles and outputs the value 222.

Why the C compiler allows the syntax return (a, b); ?

Aucun commentaire:

Enregistrer un commentaire