
May 8th, 2003, 01:51 PM
|
 |
Contributing User
|
|
Join Date: Jan 2003
Location: USA
|
|
|
As 3dfxMM points out, you need to tell the compiler how big the array will be so that it can allocate enough memory to it. There are a couple ways to do that:
1. Do it explicitly; e.g.:
char test[10];
2. Do it implicitly with an initialization string or array; e.g.:
char test[] = "Just do it like this";
int itest[] = {0,1,2,3,4,5,6,7,8,9}
If you really and honestly and truly don't want to or cannot specify its size at compile time, then use the alternative syntax and declare it as a pointer and allocate it dynamically at runtime; e.g.:
char *test;
|