Creating array with constant
Posted
by wrongusername
on Stack Overflow
See other posts from Stack Overflow
or by wrongusername
Published on 2010-03-19T21:38:36Z
Indexed on
2010/03/19
21:41 UTC
Read the original article
Hit count: 491
I was working on a program in Netbeans on Linux using a gcc compiler when, upon switching to Visual C++ on Windows 7, the code failed to compile as Visual C++ says it expected constant expression
on several lines. On Netbeans, I simply did something similar to char name[fullName.size()];
, while on Visual C++, I tried, among other things,
const int position = fullName.size();
char Name[position];
How can I create a constant to use for the array?
© Stack Overflow or respective owner