mardi 6 octobre 2015

unexpected output with comma operator

I wrote a program

#include<stdio.h>
int main()
{
      int x=3;
       if((x)==1,2,4,5,6)
               printf("number found in the list\n");
       else
               printf("Number not found \n");

      return 0;
}

I was expecting the output to be "Number not found " but it is "Number found in the list " why it is so

Aucun commentaire:

Enregistrer un commentaire