0

break and continue(C language)

can anyone post difference b/w break and continue with good example

26th Sep 2019, 9:38 AM
Reiner
Reiner - avatar
4 Answers
+ 4
break - to end a whole current loop. continue - to go to the next loop. For example, when : int i=0; while(i<10) { i++; if(i%3==0) { break; } printf("%d", i); } //Output: 12 int i=0; while(i<10) { i++; if(i%3==0) { continue; } printf("%d", i); } //Output: 124578
26th Sep 2019, 10:05 AM
ä½ ēŸ„é“č¦å‰‡ļ¼Œęˆ‘也ę˜Æ
ä½ ēŸ„é“č¦å‰‡ļ¼Œęˆ‘也ę˜Æ - avatar
+ 1
Break go out of a loop orcsome section when read by the compiler,continue go over the next iteration.
26th Sep 2019, 10:09 AM
KfirWe
KfirWe - avatar
+ 1
26th Sep 2019, 3:13 PM
ä½ ēŸ„é“č¦å‰‡ļ¼Œęˆ‘也ę˜Æ
ä½ ēŸ„é“č¦å‰‡ļ¼Œęˆ‘也ę˜Æ - avatar
0
so it breaks while loop but not if condition right???
26th Sep 2019, 12:25 PM
Reiner
Reiner - avatar