Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- void **actions = (void **)malloc(4);
- actions[0] = &&number;
- actions[1] = &&fizz;
- actions[2] = &&buzz;
- actions[3] = &&fizzbuzz;
- int a = 0;
- int b, c;
- loop:
- a++;
- b = !(a % 3);
- c = !(a % 5) << 1;
- goto *actions[b | c];
- number:
- printf("%d\n", a);
- goto loop;
- fizz:
- printf("fizz\n");
- goto loop;
- buzz:
- printf("buzz\n");
- goto loop;
- fizzbuzz:
- printf("fizzbuzz\n");
- goto loop;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement