Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #include "memory.h"
  5.  
  6. int main()
  7. {
  8. int start, length, zero, n;
  9. char c, k;
  10. char string[99];
  11. Memory myMemory;
  12.  
  13. scanf("%c %d %d", &c, &zero, &n);
  14. initMemory(&myMemory,n);
  15.  
  16. while (scanf(" %c %d", &c, &zero) != EOF){
  17. if (c == 'P')
  18. printMemory(&myMemory);
  19. else {
  20. scanf("%d%d", &start, &length);
  21. if (c == 'A')
  22. allocateMemory(&myMemory,start,length);
  23. else if (c == 'F')
  24. freeMemory(&myMemory,start,length);
  25. }
  26. }
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement