Tag Archives: C-Control-Statements

Goto Statement in C

Prerequisite – Control Statements in C The goto statement in C allows you to jump to a different point in the program’s code. It’s often considered to be a controversial feature of the language, as it can lead to unreadable and difficult-to-debug code. Syntax: The basic syntax of the goto statement in C is as follows: Here, label… Read More »

Continue Statement in C

Prerequisite – Control Statements in C In C, the “continue” statement is used to skip the current iteration of a loop and move on to the next one. Here are a couple of examples of using “continue” in different loops: Example-1: Print odd numbers between 1 and 10 using a “for” loop and “continue” Output: 1 3 5… Read More »

Switch Statement in C

Prerequisite – Control Statements in C The “switch” statement in C is a conditional statement that allows you to test the value of a variable against a list of possible values. It can be a useful alternative to a series of “if-else” statements when you have multiple conditions to test. Syntax: The basic syntax of a “switch” statement… Read More »

Do-While loop in C

Prerequisite – Control Statements in C The “do-while” loop is a loop statement in C that executes a block of code at least once, and then continues to execute the code as long as the loop condition is true. Syntax: The basic syntax of a “do-while” loop in C is: Here, the code block within the “do” statement… Read More »

While loop in C

Prerequisite – Control Statements in C In C, a “while” loop is a control structure used for repeating a set of statements as long as a certain condition is true. It is often used when the number of iterations is not known in advance, or when the number of iterations depends on the input data. Syntax: The syntax… Read More »

For loop in C

Prerequisite – Control Statements in C In C, a “for” loop is a control structure used for iterating over a range of values. It is often used to perform a set of statements a fixed number of times, or to iterate over the elements of an array. Syntax: The syntax of a “for” loop in C is as… Read More »

Nested if Statement in C

Prerequisite – Control Statements in C A nested “if” statement in C is a control statement that allows for the use of a secondary “if” statement within the body of another “if” statement. The nested “if” statement can be used to perform additional checks or to perform more specific tasks when a particular condition is met. Syntax: The… Read More »

Else if Statement in C

Prerequisite – Control Statements in C In C, the “else if” statement is used to check multiple conditions after an initial “if” statement. Syntax: The basic syntax of the “if-else if” statement in C is: Here, the code inside the first set of braces will be executed if condition1 is true; if not, the code inside the second… Read More »