Advertisement
Sosowski

Untitled

Mar 4th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. typedef struct DATA
  2. {
  3.     // stuff
  4.     int active;
  5. } DATA;
  6.  
  7. #defien MAXDATA 128
  8. DATA chunk[MAXDATA];
  9. DATA* actual_data[MAXDATA];
  10. size_t num_data;
  11.  
  12. DATA* findfree()
  13. {
  14.     for (c=0;c<MAX_DATA;c++) if (!chunk[c].active) return &chunk[c];
  15. }
  16. void insert(DATA* data)
  17. {
  18.     actual_data[num_data++] = data;
  19. }
  20.  
  21. void remove(int data_num)
  22. {
  23.     actual_data[data_num] = actual_data[--num_data];
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement