Anasayfa » C / C++

C / C++ Courses ? 14 (Break & Continue)

24 Ocak 2012 2.265 views Yorum Yok

 

 Break & Continue

We can understand this just with an example:

for(x=1; x<10; x++){
if(x==5)
                break; //exits from loop
}
printf(?x = %d ?, x); // this will print ?x=5?
x=3;
while(x<10){
if(x==5)
continue; //continue with next iteration of the loop
printf(?%d?, x);
}
//Output will be ?346789

This example is enough to explain break and continue. A small example which came to my mind right now, not related to this subject, but just to remind you some tricks.

float z= 8/16; //The value of z is not 0,5, it is 0,000000 😉

Next course is coming with the new topic ?functions?. See you there!

Ziynet Nesibe

Yoruma Açığız! :)

Be nice. İçeriği çirkin olmadığı sürece her yoruma, öneriye ve soruya "evet" :)