Example Expression statements
Previous Topic  Next Topic 

The following are all valid expression statements:



5;       // valid but does nothing

(5);     // valid but does nothing

3*2;     // valid but does nothing

3+(a*4); // valid but does nothing

a=5;     // assignment expression

a++;     // increment rvalue

a=myfunction(1,2,3,4); // Assignment_expression with function_call

myfunction(1,2,3,4);  // function_call

a=b=(5*4)+2*(b=3);   // Nested assignment expressions as rvalues.

a[a=b=(5*4)+2*(b=3)]=(1 and not (a*b) or c); // getting silly


More information about expressions will be given later here we are primarily interested in the syntax of expressions (See More On Expressions).