From 896ab0ca766efdc84e4cf87c556dedb5cdb29d64 Mon Sep 17 00:00:00 2001 From: flykhan Date: Fri, 16 Jun 2023 16:32:52 +0800 Subject: [PATCH] sizeof --- day5/d5.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 day5/d5.cpp diff --git a/day5/d5.cpp b/day5/d5.cpp new file mode 100644 index 0000000..7ca3386 --- /dev/null +++ b/day5/d5.cpp @@ -0,0 +1,25 @@ +// sizeof测试 +#include + +using namespace std; + +int main() +{ + char c = 'a'; + cout << c << endl; + cout << sizeof(c) << endl; + + short x = '1'; + cout << x << endl; + cout << sizeof(x) << endl; + + int z = 1; + cout << z << endl; + cout << sizeof(z) << endl; + + bool y = true; + cout << y << endl; + cout << sizeof(y) << endl; + + return 0; +} \ No newline at end of file