c风格字符串注意事项

 char *const p="hello";
 char ch='s';
 *p=ch;

这段代码在编译时没错调试时出错。

解决方法:

 char str[]="hello";
 char *const p=&str[0];
 char ch='s';
 *p=ch;

原文地址:https://www.cnblogs.com/children/p/1546782.html