C Programming Language

Expression statements

                   Most of the statements in a C program are expression statements. An expression statement consists of an expression followed by a semicolon. The execution of an expression causes the expression to be evaluated. The lines
A+=20;           and
printf("Hello, Good morning!\n");
are all expression statements.

Several Expression statements are shown below.

display(a,b);                   /* A function call*/
c=a+b;                             /* An assignment statement*/
c+sum(a+b);                  /* A valid , but strange statement*/
        ;                                /*An empty or null statement*/

The first statement executes a function call. The second is an assignment statement. The third expression, though strange, is still evaluated by the compiler because the function add(a,b) may perform some necessary task. The final expression shows that a statement can be empty (sometimes called a null statement).

Example :

Expression statements
continue statement Home compound statement
c program stats