#include < stdio.h >
int main()
{
int i, j;
int p = 0, q = 2;
for (i = 0, j = 0; i < p, j < q; i++, j++)
{
printf ( "GeeksforGeeks\n" );
}
return 0;
}
|
Output:
GeeksforGeeks
GeeksforGeeks
Following is the main expression to consider in the above program.
When two expressions are separated by comma operator, the first expression (i < p) is executed first. Result of the first expression is ignored. Then the second expression (j < q) is executed and the result of this second expression is the final result of the complete expression (i < p, j < q). The value of expression 'j < q' is true for two iterations, so we get "GeeksforGeeks" two times on the screen.
No comments:
Post a Comment