Hi,
Is there some way of using an array of strings? Like in basic?
I know you have to create an array of chars so i think it has to
be an 2d array or something...
There are at least a couple of ways to define/use an "array of strings".
First off, strings (in C) are arrays of char, with contents that are terminated
by a \0 char.
Thus
char String[10] = "string";
is a string, as is
char *String = "string";
(actually, in this case, the String variable is a pointer, but it points to an
array of char, terminated with a \0, so it points to a "string");
So, how do we get an array of strings? We get arrays of arrays of chars, or
arrays of pointers to chars.
Thus
char StringArray[3][10] = {"string1", "string2", "string3"};
is an array of strings, as is
char *StringArray[3] = {"string1", "string2", "string3"};
Does that help?
--
Lew Pitcher
IT Consultant, Enterprise Technology Solutions
Toronto Dominion Bank Financial Group
(Opinions expressed are my own, not my employers')