Comma Operator Program

 Program:

#include<conio.h>
#include<conio.h>
void main()
{
    int a, b, c;
    clrscr();
    c=(a=10,b=20, 2*(a+b));
    printf("a=%d", a);
    printf("\nb=%d", b);
    printf("\nc=%d", c);
    getch();
}

Output:

a=10
b=20
c=60


No comments:

Post a Comment