June 3, 2023
program to use comma operator in C language
#include<stdio.h>
int main()
{
int i,j;
for(i=0, j=10; i<=j; i++,j--)
printf("i=%d j=%d\n",i,j);
return 0;
}
output
i=0 j=10
i=1 j=9
i=2 j=8
i=3 j=7
i=4 j=6
i=5 j=5
by : Ajaj Khan
Quick Summary:
program to use comma operator in C language copy #include<stdio.h> int main() { int i,j; for(i=0, j=10; i<=j; i++,j–) printf(“i=%d j=%d\n”,i,j); return 0; } output i=0 j=10 i=1 j=9 i=2 j=8 i=3 j=7 i=4 j=6 i=5 j=5