obstacle statements:
continue, break and goto statements are obstacles use to terminate our programme.
1.continue statement me only aapka continue ke bad ka code jo loop me he execute nhi oga baki pahle ke loop ka code tab tak execute hoga jab tak loop ki condition false na ho jaye.
2.break statement ka use karne par code jese hi break statement ko reach karega vo break statement jis corresponding loop me hoga usko terminate kar dega.
3.goto statement is also known as the ultimate obstacle, jese hi code goto statement ko reach karga sabhi corresponding loops ko break karke out of loop dal dega.
// go to statement as its name it calls our programme to go
where it (go to statement) tells to go.
// it is also knon as jump statement.
// it transfers the programme to the pre-difined lable.
// it is prefer not to use go to statement because less
understandable to your fellow programmers.
// but still is used to break miltiple loops in just one
statement.
// besic syntex of go statement is that:
/* {
lable
printf (" ");
..
..
..
..
go to lable;
}*/
// exanple:_1
#include <stdio.h>
int main()
{
lable:
printf("we are in a lable.\n");
printf("hello world");
goto lable;
return 0;
}
output:_
we are in lable.
hello world
............infinite loop
............
we are in lable.
hello world
// example:_2
#include <stdio.h>
int main()
{
lable:
printf("we are in a lable.\n");
goto end;
printf("hello world");
goto lable;
end:
printf("hullo world");
return 0;
}
output:_
we are in a lable.
hullo world
No comments:
Post a Comment
here we are to help you.you can watch videos and get information about :- (1) scientific facts (2) education (3) gaming (4) music (5) lyrics (6) cartoons and many more.So keep watching keep learning, thank you.