malloc: allocate memory block and print address
This commit is contained in:
parent
8260d39d4e
commit
e3c6f75cfd
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue