- The comma operator is mainly useful for obfuscation.
- The comma operator allows grouping expression where one is expected.
- Commas can be used as separators in some contexts, such as function argument lists.
Example :
#include <stdio.h>
int main ()
{
int i = 10, b = 20, c= 30;
// here, we are using comma as separator
i = b, c;
printf("%i\n", i);
// bracket makes its one expression.
// all expression in brackets will evaluate but
// i will be assigned with right expression (left-to-right associativity)
i = (b, c);
printf("%i\n", i);
return 0;
}
Output :
20 30
No comments:
Post a Comment