That's not a character array; that's an array of character pointers. Remove the *
to make it a character array:
char c[20];
Then you can use strcpy:
strcpy(c, "undefined");
If you really did want an array of character arrays, you'll have to do what you said you tried:
// array that holds 20 arrays that can hold up to 70 chars each
char c[20][70];
// copy "undefined" into the third element
strcpy(c[2], "undefined");
The problem could have been you're missing the closing "
, I don't know if that was a paste error though. Or, the problem could have been that you're using k
without defining it, we can't know without seeing the error message you get.
If you want to set them all to that string, then just loop over them:
char c[20][70];
int i;
for (i = 0; i < 20; ++i)
strcpy(c[i], "undefined");