lwmem/docs/examples_src/example_realloc_first_malloc.c
2019-12-07 20:26:43 +01: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);