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

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -