[QUOTE=itsme86]You could do something like this easily enough:
Code:
itsme@dreams:~/C$ cat strtype.c
#include <stdio.h>
typedef char * string;
int main(void)
{
string strs[5]; // Make 5 strings
int i;
strs[0] = "first string";
strs[1] = "second string";
strs[2] = "third string";
strs[3] = "this is the fourth string";
strs[4] = "and finally this is the fifth string";
for(i = 0;i < 5;++i)
puts(strs[i]);
return 0;
}
That's very close. When i string copy (strcpy) into the array of string, the program crashes.
Code:
char myOtherString[80];
strcpy(strs[0], "Bob"); // This will crash it
strcpy(strs[1], myOtherString); // So will this method...
please advise.
thanks so much all.
szill