All articles
c

A program to explain comma operator

Share this article

Share on LinkedIn Share on X (formerly Twitter)

C Programming Language 012

The following code shows how to write a program to explain comma operator

Program

#include <stdio.h>
 
void main()
{
    int a, b, value;
 
    value = (a = 10, b = 5, a + b);
    printf("value = %d \n", value);
}

Result

value = 15

Comments