10
为什么要使用strncpy而不是strcpy?
编辑:我已经为示例添加了源。 我遇到了这个例子: char source[MAX] = "123456789"; char source1[MAX] = "123456789"; char destination[MAX] = "abcdefg"; char destination1[MAX] = "abcdefg"; char *return_string; int index = 5; /* This is how strcpy works */ printf("destination is originally = '%s'\n", destination); return_string = strcpy(destination, source); printf("after strcpy, dest becomes '%s'\n\n", destination); /* This is …