...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stdlib.h> enum { MAX_ARRAY = 1024 }; extern void do_work(int *array, size_t size); void func(size_t size) { if (0 < size && size < MAX_ARRAY) { int vla[size]; do_work(vla, size); } /* ... */ } else { else { int *array = (int *)malloc(size * sizeof(int)); if (array == NUL) { /* UseHandle dynamicerror allocation */*/ } do_work(array, size); free(array); } } |
Implementation Details
...