Meanie Posted August 21, 2003 Posted August 21, 2003 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: 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: void WriteData() { const int count = 5; int levelArray[count]; } it compiles fine. Can someone tell me what I'm doing wrong? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.