Homepage » C / C++

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

24 January 2012 2,299 views No comments


 Break & Continue

We can understand this just with an example:

for(x=1; x<10; x++){
                break; //exits from loop
printf(?x = %d ?, x); // this will print ?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


Any comments are welcome.