1.
char *quot = "l1302-C-11250"; // *quot是字符串常量,存放在静态存储区
char *p = quot;
while(*p != '\0'){
if(*p == '-'){
*p = '_'; //出错
}
p++;
}
2.
char quot[20] = "l1302-C-11250"; //字符数组,存放在堆栈中
char *p = quot;
while(*p != '\0'){
if(*p == '-'){
*p = '_'; //正确
}
p++;
}