Statements in C language | Different types of Statements in C programming Language

   

         

          C programs are collection of Statements, statements is an executable part of the program it will do some action. In general all arithmetic actions and logical actions are falls under Statements Categories anyway there are few Statement categories

  • Expression Statements.
  • Compound Statements.
  • Selection Statements.
  • Iterative Statements.
  • Jump Statements.

Expression Statements:  

                  It is combination of variables,Constants,operators,Function Calls and followed by a semicolon. Expression can be any operation like Arithmetic operation or Logical Operation.
Few Examples for expression Statements 
X = Y + 10 ;
20 > 90;
a ? b : c ;
a = 10 + 20 * 30;
;   (This is NULL Statement ).

Compound Statement :

                Compound statement is combination of several expression statements. Compound Statement is Enclosed within the Braces { }.
Compound statement is also called as Block Statement.

There is no need of any semicolon at the end of Compound Statement. 

Example for Compound Statement

{
        int a=10,b=20,c;
        c = a + b;
        printf(“value of C is : %d n”,c);


You May like : Swapping The Nibbles of Character.

Selection Statements :

                Selection Statements are used in decisions making situations we will look about selections statements in Later Tutorials. Here is the few examples of Selection statements

  • if
  • if…else
  • switch

Iterative Statements :

              These are also Called as Loops. If we want to Execute a part of program many times we will use loops.We will going to explain each and Every loop in Detail in Later Tutorials. Here is the List of Basic loops in C language.

  • for loop.
  • while loop.
  • do-while loop.

Jump Statements : 

            These are Unconditional statements Jump statements are useful for Transfer the Control one part of program to other part of Program there are few Jump Statements in C

  • goto.
  • continue.
  • break.
  • return.

           All these Selection and Iterative and Jump Statements are Keywords and all are Lower Case Characters.


Venkatesh

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

3 Responses

  1. Daniel Frappier says:

    If a C program is a list of statements, where do fit declarations like int a = 0; ? Which are declaration, not statements ? I do not really find an explanation anywhere. Thanks.

    • Hey Daniel,

      int a = 10; also a statement. All the declarations and assignments and operations all are called statements.

      So even the declarations also come under the statements.

  1. […] int n; is not a comment and It is a valid C statement, Which will be executed by the […]

Leave a Reply