This answer to the question [How to include a dynamic array INSIDE a struct in C?] Right?

Can anyone tell me if this is correct ?? I'm not sure about the distribution of the second structure:

struct dyn_array my_array = malloc(sizeof(struct dyn_array) + 100 * sizeof(int));

Do not my_array

specify a pointer, for example:

struct dyn_array *my_array = malloc(sizeof(struct dyn_array) + 100 * sizeof(int));

+3


source to share





All Articles