-
Notifications
You must be signed in to change notification settings - Fork 0
/
demonstration.c
33 lines (29 loc) · 909 Bytes
/
demonstration.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<stddef.h>
#include"fonctionAllocations.c"
int main(){
printf("Vous avez reservé %d bits\n",initMemory(1500));
printf("Votre zone de memoire: %p jusqu'a %p\n",espaceMemoireDebut,espaceMemoireFin);
void *p = myalloc(300);
void *p1 = myalloc(100);
void *p2 = myalloc(500);
printf("%d bits\n",myfree(p));
printf("%d bits\n",myfree(p2));
void *p3 = myalloc(100);
void *p4 = myalloc(100);
void *p5 = myalloc(300);
printf("%d bits\n",myfree(p1));
void *p6 = myalloc(600);
listeAllocation *defil = espaceLibres;
while(defil!=NULL){
printf("adresse %p/%d bits liberes\n",defil->debutAlloc,defil->taille*8);
defil=defil->allocSuivant;
}
printf("Les allocations restantes:\n");
while(listeAllocations!=NULL){
printf("allocation :%p\n",listeAllocations->debutAlloc);
listeAllocations=listeAllocations->allocSuivant;
}
}