I'm trying to copy some strings into a char* array, I've been trying to use strcpy, only when I do, the program crashes. The array is initialized, within a class, as:
char* Commands[MAXNUMBER]
//maxnumber is defined earlier to have a value of 10
Then I am trying to intitalize the array within the constructor funcion as follows:
strcpy(Commands[0], "status");
strcpy(Commands[1], "load");
strcpy(Commands[2], "coffee");
strcpy(Commands[3], "chocolate");
strcpy(Commands[4], "soup");
strcpy(Commands[5], "quarter");
strcpy(Commands[6], "dime");
strcpy(Commands[7], "nickel");
My first instinct told me to make the array 2 dimensional, but that did not work. How can I scan the strings into the array without having the program crash when I get to this part of the code?