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, add;
    sum = (a = 8, b = 7, c = 6, a + b + c);
    printf("add=%d\n", add);
    return 0;
}

output


add=21

Steps / Description

  1. Declare integer variable a, b, c
  2. Initialize variable a=8, b=7, c=6
  3. printf inbuild function to display value of addiction a + b + c
  4. by : Nadeem Khan

    Quick Summary:

    Comma Operator