SHARE
TWEET

niggerliscous.c

a guest Apr 20th, 2019 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. // niggerlicous.c
  3. // now compatible with gcc-4.4.7, clang-8.0.0, clang-6.0.1
  4. // -std=c99 flag not required
  5.  
  6. int printf(const char*, ...); /* <stdio.h> */
  7.  
  8. #define STOP (-1)
  9. #define LONG 123
  10.  
  11. #define PRINT(array) do {                  \
  12.     printf("%-8s:", #array);               \
  13.     int $i;                                \
  14.     for($i = 0; array[$i] != STOP; $i++) { \
  15.         if($i) printf(", %d", array[$i]);  \
  16.         else   printf(" [%d", array[$i]);  \
  17.     }                                      \
  18.     printf("]\n");                         \
  19. } while(0)
  20.  
  21. int main() {
  22.     int Ints[] = { 0, 1, 2, 3, 4, 5, STOP };
  23.     int Evens[LONG], Odds[LONG], Squares[LONG];
  24.     int *i, *e, *o, *s;
  25.  
  26.     for(i = Ints, e = Evens, o = Odds, s = Squares; *i != STOP; i++)
  27.     {
  28.         if(*i % 2) *o++ = *i;
  29.         else       *e++ = *i;
  30.         *s++ = (*i)*(*i);
  31.     }
  32.     *e = *o = *s = STOP;
  33.  
  34.     PRINT(Ints); PRINT(Evens); PRINT(Odds); PRINT(Squares);
  35.     return 0;
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top