#include <stdio.h>
int* create(int size) {
return (int* malloc(size*sizeof(int));
}
int main(void) {
int *arr = create(10);
// do something useful with memory
// e.g. maintain a dynamic list
// free(arr); // this will cause a LEAK
return 0;
}This may look like stupid programming but it is actually very hard to maintain pairwise allocation/deallocation if both can happen in functions that are far away from each other in the software package.