lwmem/docs/examples/example_realloc_first_malloc.c
2019-09-29 10:09:22 +02:00

12 lines
407 B
C

int* ints = lwmem_malloc(12 * sizeof(*ints)); /* Allocate memory for 12 integers */
/* Check for successful allocation */
if (ints == NULL) {
printf("Allocation failed!\r\n");
return -1;
}
lwmem_debug_free(); /* This is debug function for sake of this example */
/* ints is a pointer to memory size for our integers */
/* Do not forget to free it when not used anymore */
lwmem_free_s(&ints);