主页
C++
C++ 内存管理
demo_memory_management_sizeof
运行 ❯
×
更改方向
保存代码
更改主题
#include
using namespace std; int main() { int myInt; float myFloat; double myDouble; char myChar; cout << sizeof(myInt) << "\n"; // 4 bytes (typically) cout << sizeof(myFloat) << "\n"; // 4 bytes cout << sizeof(myDouble) << "\n"; // 8 bytes cout << sizeof(myChar) << "\n"; // 1 byte return 0; }
4
4
8
1