Last active
October 12, 2018 00:05
-
-
Save wrl/a2d0d043dc33bdb96c9c04005acf20ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int | |
main(int argc, char **argv) | |
{ | |
int i; | |
void *jump[] = { | |
[0] = &&printn, | |
[1] = &&fizz, | |
[2] = &&buzz, | |
[3] = &&fizzbuzz, | |
[4 ... 7] = &&done | |
}; | |
#define NEXT do { \ | |
i++; \ | |
\ | |
goto *jump[( \ | |
(!(i % 3)) \ | |
| ((!(i % 5)) << 1) \ | |
| ((i > 100) << 2) \ | |
)]; \ | |
} while (0) | |
i = 0; | |
printn: | |
printf("%d\n", i); | |
NEXT; | |
fizz: | |
puts("fizz"); | |
NEXT; | |
buzz: | |
puts("buzz"); | |
NEXT; | |
fizzbuzz: | |
puts("fizzbuzz"); | |
NEXT; | |
done: | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment