I need to create a non-dynamic array like this

void f(int x)
{
int[x] my_array;
...

this does not compile as x value needs to be known at compile time. The closest to this I can get is:

void f(int x)
{
int[] my_array;
my_array.length=x;

but I don't really need a dynamic array as length is not going to change inside f.

What is the best way to do this?

Thanks in advance

Reply via email to