+ 2
Are arrays in C static?
Is it possible to change the size (number of elements it can store) to x after you have declared it with the size y? How?
2 Answers
+ 10
nope. Length is fixed during initialization. Use list if you need variable length.
+ 5
Or you make a pointer and allocate the memory manually (void *malloc(size_t size) ). This way you can access it like a normal array. You can use sizeof(int) to get the size of a singele integer variable (or whatever you want to store) and just multiply it by the length of the array, that's how much memory you'll need. Don't forget to free() the memory afterwards though.