we can declare array of strings the following way:
char *words[] = { "abc", "def", "bad", "hello", "captain", "def", "abc", "goodbye" };
Now I have an existing array of strings suppose:
char strings[4][20];
strcpy(strings[0], "foo");
strcpy(strings[1], "def");
strcpy(strings[2], "bad");
strcpy(strings[3], "hello");
I want to do something like this:
char *words[4];
for ( j = 0; j < 4; j++)
{
words[j] = &strings[j];
}
So that words would have the same structure as if I have defined it as in the beginning. Do you guys know how to do that?
hostsin this context?