I need some confirmation. I always get correct o/p but someone told me following expression will not work
Thanks in advance.
#define a 11
#define b 12
#define c 13
// I want if array[i] has values of any of these then do something
if( array[i] == (a) ||(b) ||( c))
// some function
else
printf("no match");
Replace your code with this:
if( array[i] == a || array[i] == b || array[i] == c)Each part of the boolean condition must be a complete expression. While what you wrote is valid C code, it doesn’t achieve what you want: you need to make an array element comparison in every part.