Übung 5
This commit is contained in:
19
Assets/Betriebssysteme_uebung/u6-a3-anlage/malloc.c
Normal file
19
Assets/Betriebssysteme_uebung/u6-a3-anlage/malloc.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
int *p;
|
||||
|
||||
p = malloc(sizeof(int));
|
||||
if(p != NULL) {
|
||||
*p=99;
|
||||
printf("Allokation erfolgreich ... \n");
|
||||
}
|
||||
else {
|
||||
printf("Kein virtueller RAM mehr verfügbar ...\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
free(p);
|
||||
printf("Speicher nun erfolgreich freigegeben ");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user