strcat(dest, “\something”) - backslash not showing
问题 I got a problem with C programming string concatenation. Why strcat(dest, "\something") will not have the backslash copied to dest ? You may wish to follow the example. #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char *dest = ""; char *test = "how \something"; dest = (char *)malloc((strlen(test) + 1) * sizeof(char)); strcat(dest, test); // Expect to see "how \something", but showed "how something" printf("%s\n", dest); free(dest); return 0; } 回答1: backslash not