From e3c6f75cfddb11d3c0f2854378da8a164118f446 Mon Sep 17 00:00:00 2001 From: hjp Date: Tue, 5 Jul 2016 19:55:08 +0000 Subject: [PATCH] malloc: allocate memory block and print address --- hogs/malloc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 hogs/malloc.c diff --git a/hogs/malloc.c b/hogs/malloc.c new file mode 100644 index 0000000..19e99ae --- /dev/null +++ b/hogs/malloc.c @@ -0,0 +1,10 @@ +#include +#include + +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; +}