I want to create an array in a function using an integer that I pass. The compiler requires that I use a contant value, so I am trying to use the following:
What happens is the compiler gives me an error and tells me that count isnt a constant.
However, when I try this:
it compiles fine.
Can someone tell me what Im doing wrong?
Code:
void WriteData(const int count)
{
int levelArray[count];
}
What happens is the compiler gives me an error and tells me that count isnt a constant.
However, when I try this:
Code:
void WriteData()
{
const int count = 5;
int levelArray[count];
}
it compiles fine.
Can someone tell me what Im doing wrong?