void foo(constdouble va, constint q) {
int qaa[q];
......
return;
}
However, the compiler indicates allocator cannot allocate an array of constant size 0...
Could someone please tell me why, and how can I use the argument "q" to fix the size of array "qaa"?
Thanks a lot!
So far as I've tried, this may not be possible.
But what you could do is int qaa[/*Max Here*/] and use a selected portion of that array.
Hope this helps.
I think he meant more along the lines of making the array "qaa" dynamically allocated. i.e Make it a pointer to the address of "qaa"
so int *qaa = newint[SIZE];
This is because normal arrays need to have a specific size before the program runs so that the compiler can allocate that much memory for each array. But since you will be specifying the memory during run time, you need to have a dynamically allocated array.