...
| Code Block | ||
|---|---|---|
| ||
int nums[SIZE];
char *strings[SIZE];
int *next_num_ptr = nums;
int free_bytes;
/* increment next_num_ptr as array fills */
free_bytes = strings - (char **)next_num_ptr;
|
The first incorrect assumption is that nums and strings arrays are necessarily contingent in memory. The second is that free_bytes is the number of bytes available. The subtraction returns the number of elements between next_num_ptr and strings.
...