Jumping Statements in C Tamil - linto.in
jumping statement in c tamil, சாதாரணமாக run-ஆக கூடிய program-ஐ ஒரு statement குறுக்கிட்டு program-ன் flow of execution-ஐ மாற்றி விடும், இந்த statement-ஐ Jumping statement என்று அழைக்கபடுகிறது.
Jumping Statement
Jumping statements என்பது சாதாரணமாக run ஆககூடிய program-ஐ குறுக்கிட்டு அதை மாற்றுவது Jumping statement.
Types of Jumping Statement
1. Break
2. Continue
3. GoTo
Break Statement
Break statement என்பது loop or switch statement-க்கு உள்ளே பயன்படுதகூடியதாகும். ஒரு loop-க்கு உள்ளே break statement-ஐ கண்டறிந்தால் உடனடியாக loop run-ஆகுவதை compiler நிறுத்திவிடும்.
Example
#include<stdio.h>
#include<conio.h>
int main(){
int a;
for(a=1;a<=10;a++){
if(a==3){
break;
}
printf("\n My Executable Statement %d.",a);
}
printf("\nEnd of the Program.");
return 0;
}
My Executable Statement 2.
My Executable Statement 3.
End of the Program.
Continue Statement
Continue statement-ம் loop-க்கு உள்ளே பயன்படுதகூடியதாகும். Loop-க்கு உள்ளே continue statement-ஐ கண்டறிந்தால், compiler Loop-ல் continue statement-க்கு அடுத்து வரும் statements-ஐ skip செய்து விட்டு மீண்டும் loop run ஆகும்.
Example
#include<stdio.h>
#include<conio.h>
int main(){
int i;
for(i=1;i<=10;i++){
if(i%2==0)
continue;
}else{
printf("\n %d",i);
}
}
return 0;
}
Output:
13
5
7
9
Goto Statement
எந்த ஒரு condition-ம் இல்லமால் ஒரு program-ல் நாம் விரும்பிய எந்த ஒரு பகுதிக்கும் program execution-ஐ மாற்றிக்கொள்ள பயன்படுகிறது. இதில் label or identifier and goto statement-ஐ பயன்படுத்த வேண்டும்.
Syntax
goto label;
- - - - - - - - - -
- - - - - - - - - -
label:
- - - - - - - - - -
- - - - - - - - - -
Example
#include<stdio.h>
#include<conio.h>
int main(){
printf("\n Executable Statement 1.");
printf("\n Executable Statement 2.");
goto last;
printf("\n Executable Statement 3.");
printf("\n Executable Statement 4.");
printf("\n Executable Statement 5.");
last:
printf("\n This is End of The Program.");
return 0;
}
Executable Statement 2.
This is End of The Program.