r/cprogramming • u/long_onion1 • Oct 25 '26
what is the difference between a (specifc) while loop and a (specific) for loop (read body)
what is the difference between
for (i = 0; i < 10; i++) {}
and
i = 0;
while (i < 10) {
i++;
}
edit: thank you all for commenting, now i know, and u/deckarep, no not homework, just a question, to see if there were any difference
12
Upvotes
View all comments
Show parent comment
0
u/Rararror Oct 26 '26
"continue" IS JUMPING. Every jump goes in a well defined place.
Why don't you just label somewhere and "goto" it so you "skip a lot going on" ?
Conditional blocks and variables have the benefit that you are forced to think what you are doing. Oftentimes thinking about how to solve the logic simplifies things.
Writing code IS thinking.