I wrote the following C program:
int main(int argc, char** argv) { char* str1; char* str2; str1 = \"sssss\"; str2 = \"kkkk\"; printf(\"%
strcat(str1, str2) appends str2 after str1. It requires str1 to have enough space to hold str2. In you code, str1 and str2 are all string constants, so it should not work. You may try this way:
strcat(str1, str2)
char str1[1024]; char *str2 = "kkkk"; strcpy(str1, "ssssss"); strcat(str1, str2); printf("%s", str1);