SHARE
TWEET

Tastebin - Tkabber Plugin

a guest Jun 23rd, 2012 31 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #define STACK_SIZE 10
  5.  
  6. void addFunc(void (*)(void));
  7. void eval(void);
  8. void test(void);
  9.  
  10. unsigned int cFunc = 0;
  11. void (*tFunc[STACK_SIZE])(void);
  12.  
  13. void addFunc(void (*pfunc)(void))
  14. {
  15.     if (cFunc == STACK_SIZE)
  16.     {
  17.         fprintf(stderr, "stack overflow\n");
  18.         return;
  19.     }
  20.  
  21.     tFunc[cFunc] = pfunc;
  22.     cFunc++;
  23. }
  24.  
  25. void eval()
  26. {
  27.     int i;
  28.     for (i = 0; i < STACK_SIZE; i++)
  29.         tFunc[i]();
  30. }
  31.  
  32. void test()
  33. {
  34.     static int tmp = 0;
  35.     printf("%d\n", tmp++);
  36. }
  37.  
  38. int main(int argc, char *argv[])
  39. {
  40.     int i;
  41.     for (i = 0; i < 15; i++)
  42.         addFunc(test);
  43.  
  44.     eval();
  45.  
  46.     return 0;
  47. }
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