break and continue in c difference - learnit

Home Top Ad

Post Top Ad

Saturday, August 7, 2021

break and continue in c difference

break and continue in c difference

Why Learn C Programming?

C enables you to comprehend a computer's internal architecture, as well as how it stores and retrieves data.


Learning other programming languages such as Java, Python, and others will be much easier after learning C.


Possibility of working on open source projects. Some of the most important open-source projects, such as the Linux kernel, Python interpreter, SQLite database, and so on, are written in C.


How to learn C Programming?

C tutorial from Programiz - We provide step-by-step C tutorials, examples, and references. Begin with C.


Official C documentation - Beginners may find it difficult to follow and comprehend. Visit the official documentation for C programming.


Write a lot of C programming code - You can only learn programming by writing a lot of code.


break and continue in c difference

Break Statement Continue Statement
To exit the loop constructs, use the Break statement.To exit the loop constructs, the continue statement is not used.
The break statement is typically used in conjunction with the switch statement, but it can also be used within the while loop, do-while loop, or for-loop.The continue statement is not used in conjunction with the switch statement, but it can be used within a while loop, do-while loop, or for-loop.
When a break statement is encountered, the control is immediately removed from the loop construct.When the continue statement is encountered, control is automatically transferred back to the beginning of the loop statement.
Syntax:
break;
Syntax:
continue;

Example Break

#include<stdio.h>
#include<conio.h>
main()
{
int i;
for(i=1;i<=15;i++){
if(i==10 || i==15){
break;
}
printf("%d\n",i);
}
getch();
}


Example

#include<stdio.h>
#include<conio.h>
main()
{
int i;
for(i=1;i<=15;i++){
if(i==10 || i==15){
continue;
}
printf("%d\n",i);
}
getch();
}


Please Watching My Video is Below

1 comment:

Post Top Ad