如题,按照我的理解,下列程序中,*(p+0)指向字符't',而*(p+1)指向字符'e',依此类推。而*(p+0)='T';这一语句会让字符串从test变成Test,printf输出时应输出Test,为何会导致程序崩溃?#includeintmain(void){char*p="test";*(p+0)='T';printf("%s\n",p);return0;}
#includeintmain(void){char*p="test";*(p+0)='T';printf("%s\n",p);return0;}
intmain(void){char*p="test";*(p+0)='T';printf("%s\n",p);return0;}
{char*p="test";*(p+0)='T';printf("%s\n",p);return0;}
char*p="test";*(p+0)='T';printf("%s\n",p);return0;}
*(p+0)='T';printf("%s\n",p);return0;}
printf("%s\n",p);return0;}
return0;}
}
慕工程0101907
慕虎7371278
相关分类