Published by: Nuru
Published date: 21 Jun 2021
In an introduction to control statements, we say that they are the statements that determine whether other statements will be executed. In C programs, we execute statements sequentially in the order in which they appear in the program. They are the primary building blocks of a program. It is a complete instruction to the computer to carry out some tasks. Control statements enable us to specify the order in which the various instructions in the program are to be executed. This determines the flow of control. Control statements define how the control is transferred to other parts of the program.
The statements such as sequence, selection, iteration, and jump statements control the flow of the execution of the program. And, we call them program control statements. The common control statements available in C are:
The normal flow of execution in a high-level language is sequential. That is, there is the execution of each statement in the order of its appearance in the program. However, depending on the requirement of a problem, it might require altering the normal sequence of execution in a program. The statements which specify the order of execution of statements are control flow statements. Actions may be in the form of data movement, decision-making, etc.
There are also some other statements such as assignment statements, function statements, and label statements. The assignment statement is the workhouse of many programs. It assigns a value to the variable. It consists of a variable name followed by the assignment operator (=). A semicolon follows this. A function statement causes the function to do whatever it does. For instance, we invoke the printf () function to print some results. We create the label statements using case, default. There is the use of label statements with other statements such as a switch, goto, etc.