Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include "memory.h"
- int main()
- {
- int start, length, zero, n;
- char c, k;
- char string[99];
- Memory myMemory;
- scanf("%c %d %d", &c, &zero, &n);
- initMemory(&myMemory,n);
- while (scanf(" %c %d", &c, &zero) != EOF){
- if (c == 'P')
- printMemory(&myMemory);
- else {
- scanf("%d%d", &start, &length);
- if (c == 'A')
- allocateMemory(&myMemory,start,length);
- else if (c == 'F')
- freeMemory(&myMemory,start,length);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement