is an example: #include <stdio.h> #include <assert.h> int main ( void ) { int i; for (i=0; i<=9; i++) { assert( ( "i is too big!", i <= 4 ) ); printf("i = %i\n", i); } return 0; } Output: i = 0 i = 1 i = 2 i = 3 i = 4 assert: assert.c:6: test_assert: Assertion `( "i is too big!", i <= 4 )' failed. Aborted However the assert macro is usually disabled in production code, so use it only for debug purposes. Condition The comma can be used within a condition (of an if, while, do while, or for) to allow auxiliary computations, particularly calling a function and using the result, with block scoping: if (y = f(x), y > x) { ... // statements involving x and y } A similar idiom exists in Go, where the syntax of the if statement explicitly allows an optional statement. Complex return The comma can be used in return statements, to assign to a global variable or out parameter (passed by reference). This idiom suggests that the assignments are part of the return, rather than auxiliary assignments in a block that terminates with the actual return. For example, in setting a global error number: if (failure) return (errno = EINVAL, -1); This can be written more verbosely as: if (failure) { errno = EINVAL; return -1; } Avoid a block For brevity, the comma can be used to avoid a block and associated braces, as in: if (x == 1) y = 2, z = 3; if (x == 1) y = 2, z = 3; instead of: if (x == 1) {y = 2; z = 3;} if (x == 1) { y = 2; z = 3; } Other languages In the OCaml and Ruby programming languages, the semicolon (";") is used for this purpose. JavaScript and Perl utilize the comma operator in the same way C/C++ does. In Java, the comma is a separator used to separate elements in a list in various contexts. It is not an operator and does not evaluate to the last element in the list. See also Sequence point Operators in C and C++ Operator (programming) References Bibliography External links "Effect of using a comma instead of a semi-colon in C and C++", Stack Overflow Boost.Assignment – facility from the Boost library that makes it easy to fill containers