....

C Language

May 20, 2023

How to use comma operators in c language

program to use comma operators in c language


#include<stdio.h>
int main()
{
    int e,f,g,sum;
    sum = (e=6,f=4,g=12,a+b+c);
    printf("sum=%d\n",sum);
    return 0;
}

output


sum=24

Steps Description

  1. Declare integer four variables e , f and g and sum
  2. initialize in integer variables e , f and g
  3. Assign sum variable with sum of variables e and f and g
  4. printf inbuild function display sum variable with decimal placeholder %d

by : Ajaj Khan

Quick Summary:

use comma operators in c language