#include<stdio.h>
#include<string.h>
int main(){
char *t[3]={"ilovei","iloveb","ilovez"};
t[2]="dg";
printf("%s",t[2]);
strcpy(t[2],"dg");
}
debug中发现 t[2]="dg";命令可以正常运行,但一运行 strcpy(t[2],"dg"); 就提示
program received signal SIGSEGV,sengmentaion fault.
这两行命令都是往指针数组的第二项进行进行赋值,第二条命令却不能执行。感到很费解,