C Language

May 22, 2023

Comma Operator in C

Program to use comma operator in C


#include <stdio.h>
int main()
{
    int a, b, c, sum;
    sum = (a = 8, b = 7, c = 9, a + b + c);
    printf("sum=%d\n", sum);
    return 0;
}

output


sum=24

by : Nadeem Khan

Quick Summary:

In this given value 3 a, b, c will sum all three value of a is 8 b value is 7 c value is 9 sum of all three values will be 24