Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // niggerlicous.c
- // now compatible with gcc-4.4.7, clang-8.0.0, clang-6.0.1
- // -std=c99 flag not required
- int printf(const char*, ...); /* <stdio.h> */
- #define STOP (-1)
- #define LONG 123
- #define PRINT(array) do { \
- printf("%-8s:", #array); \
- int $i; \
- for($i = 0; array[$i] != STOP; $i++) { \
- if($i) printf(", %d", array[$i]); \
- else printf(" [%d", array[$i]); \
- } \
- printf("]\n"); \
- } while(0)
- int main() {
- int Ints[] = { 0, 1, 2, 3, 4, 5, STOP };
- int Evens[LONG], Odds[LONG], Squares[LONG];
- int *i, *e, *o, *s;
- for(i = Ints, e = Evens, o = Odds, s = Squares; *i != STOP; i++)
- {
- if(*i % 2) *o++ = *i;
- else *e++ = *i;
- *s++ = (*i)*(*i);
- }
- *e = *o = *s = STOP;
- PRINT(Ints); PRINT(Evens); PRINT(Odds); PRINT(Squares);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement