It's like this:
A for loop has four parts, the initialization, the condition, the update, and the body.
Code:
for(initialization; condition; update) {
// the body
}
The way it works is, first it runs the initialization. Then it checks the condition. Then it runs the body, updates the variables, and checks the condition again. If it's still true, it repeats. It only initializes the first time. There for, when you have:
Code:
for (putchar('1'); putchar('2'); putchar('3')) {
putchar('4');
continue;
putchar('5');
}
the first time through, it outputs the 1. That's the initialization. Then it outputs the two. That's the condition. Then it outputs the 4. That's the body. Then, it hits the continue, which sends it to the end brace. It outputs the 3. That's the update. And then it repeats outputting the condition, body, and update. Your expected output would look something like:
Code:
124324324324324324324324
...and so on. Now, if you put a break in there instead of continue. It outputs the initial 124, and instead of going to the end of the loop and updating, it just exits the loop completely. Leaving you with just the initial 124.