malloc: allocate memory block and print address

This commit is contained in:
hjp 2016-07-05 19:55:08 +00:00
parent 8260d39d4e
commit e3c6f75cfd
1 changed files with 10 additions and 0 deletions

10
hogs/malloc.c Normal file
View File

@ -0,0 +1,10 @@
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
size_t size = strtoul(argv[1], NULL, 0);
char *p = malloc(size);
printf("%zu bytes at %p\n", size, p);
sleep(10);
return 0;
}