Can i set a 2D array on C as (fixed)(dynamic)? -


i have question. can set array [fixed][dynamic]?, first value reader file ( numbers of sensors used user ) , other value dynamic array [time of reading].

i reading 2d dynamic arrays, not know if can this. advise?.

thanks.

sure can... declare array of pointers. can use malloc , realloc modify subarray stored @ each element.

struct reading * data[num_sensors]; 

but you're kinda talking both dimensions being dynamic. might need:

struct reading ** data = malloc(sizeof(struct reading*) * num_sensors); 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -