Program to use comma operator in C
#include <stdio.h>
int main()
{
int a, b, c, add;
sum = (a = 8, b = 7, c = 6, a + b + c);
printf("add=%d\n", add);
return 0;
}
output
add=21
Steps / Description
- Declare integer variable
a
,b
,c
- Initialize variable
a=8
,b=7
,c=6
printf
inbuild function to display value of addictiona + b + c