关于tempfile.exe出错
大家请看下面一段程序
#include "iostream.h "
void main()
{
char *const pString= "asf ";
pString[0]= 'b ';
cout < <*pString < <endl;
}
编译是没有错误的,但是运行起来却说tempfile.exe需要出问题需要关闭,关于tempfile.exe出错我已经不是第一次遇到了,这是怎么回事呢?向高手请教
[解决办法]
试图改变个字符串常量出错.
#include "iostream.h "
void main()
{
char a[] = "asf ";
char *const pString=a;
pString[0]= 'b ';
cout < <pString < <endl;
}