以下代码给出的输出为 C 中的 1, 4, 4 而 C++ 中的 1, 1, 4
#include<stdio.h>
int main()
{
char ch = 'A'; //initialise
//printing output
printf("%d, %d, %d", sizeof(ch), sizeof('A'), sizeof(3.14f));
return 0;
}
最佳答案
因为字 rune 字在 C 中是 int
类型,但在 C++ 中是 char
类型。
关于c++ - 为什么以下代码在 C 、 C++ 中给出不同的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25306946/