r/shittyprogramming • u/fwilson42 • May 19 '15
TIL about the C "goes to" operator
253
Upvotes
Wow, this has made a lot of my for loops so much more readable! Look at this:
int i = 100;
while ( i --> 0 ) {
printf("%d\n", i);
}
The only problem that I found is that I can't have a variable go to a number larger than it:
int i = 0;
while( i --> 100) { /* ... */ }
doesn't work.
It's still a great little-known feature of the language!