【发布时间】:2015-10-28 22:48:11
【问题描述】:
我写了这段 C 代码:
#include<stdio.h>
#include<string.h>
int main()
{
char *i, *p, *p1="Hello";
strcpy(p,p1); //The first strcpy works.
printf("%s\n", p); //show copy successful
printf("Please hit a key to continue....\n");
getchar();
strcpy(i,p); //The second strcpy causes stop working problem. Why?
printf("%s\n", i);
return 0;
}
谁能告诉我为什么第二个strcpy 不起作用?
【问题讨论】: