I just saw a pretty good example on SO that got deleted.
#include <stdio.h> int main() { int i = 1; for (i = 0; i = -1; i = 1) { printf("%d ", i); if (i != 1) break; } return 0; }
output of this code is -1. Can someone explain to me how?
This is a perfect example of a question where the best (imo) thing to do is to just link to a page that describes in detail how a for loop works.
I think this can be a bit dangerous. If not handled in a good way, that tag can be used as an excuse for bad questions.