...
Code Block | ||
---|---|---|
| ||
size_t num_elements; /* =initialize get_size();num_elements to the number of elements needed */ long *buffer = calloc(num_elements, sizeof(long)); if (buffer == NULL) { /* handle error condition */ } /*...*/ free(buffer); buffer = NULL; |
...
Code Block | ||
---|---|---|
| ||
long *buffer; size_t num_elements; /* =initialize calc_size();num_elements to the number of elements needed */ if (num_elements > SIZE_MAX/sizeof(long)) { /* handle error condition */ } buffer = calloc(num_elements, sizeof(long)); if (buffer == NULL) { /* handle error condition */ } |
...