C++ 空字符
本来想定义一个空的字符,想当然的就写成了下面的样子:
#include <iostream>
using namespace std;
int main()
{
char ch = '';
cout<<ch<<endl;
return 0;
}
运行直接报错
加上'\0'
就对了 , 哎 基础呀。。。。。
#include <iostream>
using namespace std;
int main()
{
char ch = '\0';
cout<<ch<<endl;
return 0;
}