by Dinesh Thakur Category: Control Structures

In this example, the initial and final values of loop variable i (of type int) are 1 and 10, respectively. The increment expression, i += 1, increases the value of i by 1. Thus, i assume values 1, 2, 3, 4 and 5.

 
by Dinesh Thakur Category: Control Structures

In some situations we may have to change the order of execution of statements based on certain conditions , or repeat a group of statements until certain specified conditions are met. For these situation C provides decision making statements also know as control statements. C has following control statements:

 
by Dinesh Thakur Category: Control Structures

For loop: When it is desired to do initialization, condition check and increment/decrement in a single statement of an iterative loop, it is recommended to use 'for' loop.

 
by Dinesh Thakur Category: Control Structures

C has looping , in which a sequence of statements are executed until some conditions for termination of the loop are satisfied.

 
by Dinesh Thakur Category: Control Structures

C has GOTO statement but one must ensure not to use too much of goto statement in their program because its functionality is limited and it is only recommended as a last resort if structured solutions are much more complicated. First let us see what the goto statement does, its syntax and functionality. The goto is a unconditional branching statement used to transfer control of the program from one statement to another.

 
by Dinesh Thakur Category: Control Structures

Switch statement is a powerful statement used to handle many alternatives and provides good presentation for C program. But there are some limitations with switch statement which are given below:

 
by Dinesh Thakur Category: Control Structures

switch statement is generally best to use when you have more than two conditional expressions based on

a single variable of numeric type. For instance, rather than the code

 
by Dinesh Thakur Category: Control Structures

No, but it is not a bad idea to put default statements in switch statements for error- or logic-checking

purposes. For instance, the following switch statement is perfectly normal:

 

Page 4 of 4



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles