How can I specify the size of an array at runtime??
I want try to do somethink like this:
void myfunc(int x,int y)
but this always gives me an compiler error ''constant expression expected''
so isn''t there a way to specify an array at runtime?
Any help will be appreciated!
The second may look a little gnarly at first glance, but its fairly elegant (in the c style, so no c++ flames please!) It cuts your malloc and free needs to 1 of each instead of sizex+1, and you can address it like a "normal" 2d array.
Disclaimer: I didn''t check or compile the code, so don''t use it blindly!
I would create a template class and then overload the  operator. Out there somewhere is an apmatrics class that can handle 2 dimensional arrays like this. There is also an apvector class that does the same for one dimensional arrays. You''ll have to search for them though.