【发布时间】:2021-10-30 18:27:27
【问题描述】:
#include <iostream>
using namespace std;
int main() {
for(int i = 0; i < 10; i++) {
//print a char including two spaces
cout<<' '<<endl;
//output shows me 8224
}
system("pause");
return 0;
}
Here is the screenshot of the output
为什么会显示 8224?
【问题讨论】:
-
那不会编译,更不用说运行和打印任何东西了。
-
char * p不是字符。它是一个指向字符的指针 -
多字符字面量的值取决于实现。不要在没有查阅编译器文档的情况下使用它们。
-
为什么当我打印一个包含两个空格的字符时,输出会显示整数值?
-
您的代码无法编译 godbolt.org/z/oc4n8Mv3G