Showing posts with label for statement. Show all posts
Showing posts with label for statement. Show all posts

Wednesday, 19 October 2011

Other than in a for statement, when is the comma operator used?

The comma operator is commonly used to separate variable declarations, function arguments, and expressions, as well as the elements of a for statement. Look closely at the following program, which shows some of the many ways a comma can be used:

#include <stdio.h>
#include <stdlib.h>
void main(void);
void main()
{

/* Here, the comma operator is used to separate
three variable declarations. */
int i, j, k;