Jump control statements In C, jump statements are
Description: Jump control statements In C, jump statements are used to jump from one part of the code to another altering the normal flow of the program. They are used to transfer the program control to somewhere else in the program. Types of Jump
Related Topics
Download Presentation
"Jump control statements In C, jump statements are" is the property of its rightful owner. Permission is granted to download and print the materials on this website for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Presentation Transcript
slide1. Jump control statements<br>
slide2. In C, jump statements are used to jump from one part of the code to another altering the normal flow of the program. They are used to transfer the program control to somewhere else in the program.
Types of Jump Statements in C
There are 4 types of jump statements in C:
1. break
2. continue
3. goto
4. return<br>
slide3. 1. break in C
The break statement exits or terminates the loop or switch statement based on a certain condition, without executing the remaining code.
break is a keyword in “c” statement is used to terminate the loop i.e., the control comes out from the current loop. When over the break keyword is encountered. It is also called as loop terminator.
The break statement is widely used with for loop, while loop & do-while loop.
Syntax : break;<br>
slide4. 2. Continue in C
The continue statement in C is used to skip the remaining code after the continue statement within a loop and jump to the next iteration of the loop. When the continue statement is encountered, the loop control immediately jumps to the next iteration, by skipping the lines of code written after it within the loop body.
The continuous statement is opposite to break statement. It appears in the body of the loop. Whenever a continuous statement appears the rest of the statements in the loop are skipped. And it continuous with the next iteration of current loop.
Syntax : continue;<br>
slide5. 3. Goto Statement in C
The goto statement is used to jump to a specific point from anywhere in a function. It is used to transfer the program control to a labeled statement within the same function.
It doesn’t require any condition goto is a keyword in ‘c’ this statement process control any where in the program. i.e., control is transferred to another part of program without testing any condition. The user has to define goto statement as follows.
Syntax: goto label;<br>
slide6. 4. Return Statement in C
The return statement in C is used to terminate the execution of a function and return a value to the caller. It is commonly used to provide a result back to the calling code.
Syntax: return expression;<br>
slide7. THANK YOU<br>
slide2. In C, jump statements are used to jump from one part of the code to another altering the normal flow of the program. They are used to transfer the program control to somewhere else in the program.
Types of Jump Statements in C
There are 4 types of jump statements in C:
1. break
2. continue
3. goto
4. return<br>
slide3. 1. break in C
The break statement exits or terminates the loop or switch statement based on a certain condition, without executing the remaining code.
break is a keyword in “c” statement is used to terminate the loop i.e., the control comes out from the current loop. When over the break keyword is encountered. It is also called as loop terminator.
The break statement is widely used with for loop, while loop & do-while loop.
Syntax : break;<br>
slide4. 2. Continue in C
The continue statement in C is used to skip the remaining code after the continue statement within a loop and jump to the next iteration of the loop. When the continue statement is encountered, the loop control immediately jumps to the next iteration, by skipping the lines of code written after it within the loop body.
The continuous statement is opposite to break statement. It appears in the body of the loop. Whenever a continuous statement appears the rest of the statements in the loop are skipped. And it continuous with the next iteration of current loop.
Syntax : continue;<br>
slide5. 3. Goto Statement in C
The goto statement is used to jump to a specific point from anywhere in a function. It is used to transfer the program control to a labeled statement within the same function.
It doesn’t require any condition goto is a keyword in ‘c’ this statement process control any where in the program. i.e., control is transferred to another part of program without testing any condition. The user has to define goto statement as follows.
Syntax: goto label;<br>
slide6. 4. Return Statement in C
The return statement in C is used to terminate the execution of a function and return a value to the caller. It is commonly used to provide a result back to the calling code.
Syntax: return expression;<br>
slide7. THANK YOU<br>