I have two arrays of pointers, that is,
char *a[3]= {"man","dog","cat"};
char *b[3]= {"job","rain","sleep"};
I want to separate the three strings of both above into three different characters arrays and then I want to concatenate the string from *b[]
to the end of string from *a[]
.
How can I accomplish this? I don't want to print the separated strings.
char *
to point to string literals. You needconst char *
.char *
to point to string literals. Read the C Standard: For character string literals, the array elements have typechar
… If the program attempts to modify such an array, the behavior is undefined.