learn c language

continue statement in C Language

The continue statement in C programming works somewhat like the break statement. Instead of forcing termination, it forces the next iteration of the loop to take place, skipping any code in between. For the for loop, continue statement causes the conditional test and increment portions of the loop to execute. For the while and do…while […]

break statement in C Language

The break statement in C programming has the following two usages − When a break statement is encountered inside a loop, the loop is immediately terminated and the program control resumes at the next statement following the loop. It can be used to terminate a case in the switch statement (covered in the next chapter). […]

multiple loop variables in C Language

C programming allows to use one loop inside another loop. The following section shows a few examples to illustrate the concept. Syntax The syntax for a nested for loop statement in C is as follows − for ( init; condition; increment ) { for ( init; condition; increment ) { statement(s); } statement(s); } The […]

for loop in C Language

A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times. Syntax The syntax of a for loop in C programming language is − for ( init; condition; increment ) { statement(s); } Here is the flow of control in a […]

do while loop in C Language

Unlike for and while loops, which test the loop condition at the top of the loop, the do…while loop in C programming checks its condition at the bottom of the loop. A do…while loop is similar to a while loop, except the fact that it is guaranteed to execute at least one time. Syntax The […]

while loop in C Language

A while loop in C programming repeatedly executes a target statement as long as a given condition is true. Syntax The syntax of a while loop in C programming language is − while(condition) { statement(s); } Here, statement(s) may be a single statement or a block of statements. The condition may be any expression, and […]

Loops in C Language

You may encounter situations, when a block of code needs to be executed several number of times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on. Programming languages provide various control structures that allow for more complicated execution paths. A loop statement […]

switch statement in C Language

A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case. Syntax The syntax for a switch statement in C programming language is as follows − switch(expression) { case constant-expression : statement(s); […]

if statement in C Language

An if statement consists of a Boolean expression followed by one or more statements. Syntax The syntax of an ‘if’ statement in C programming language is − if(boolean_expression) { /* statement(s) will execute if the boolean expression is true */ } If the Boolean expression evaluates to true, then the block of code inside the […]

Control Statements in C Language

Decision making structures require that the programmer specifies one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false. Show below is […]

1 8 9 10 11 12