From f784d894908ada840af6e2f77e08d786d40e010d Mon Sep 17 00:00:00 2001 From: Shockwave Date: Fri, 29 Sep 2023 09:29:22 +0800 Subject: [PATCH] Sub: update types Body: ==== End ==== --- snippet/cpp/test_type.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/snippet/cpp/test_type.c b/snippet/cpp/test_type.c index 58a0214..f82d417 100644 --- a/snippet/cpp/test_type.c +++ b/snippet/cpp/test_type.c @@ -9,5 +9,21 @@ int main(int argc, char **argv) { printf("Size of long: %lu bytes\n", sizeof(long)); printf("Size of long int: %lu bytes\n", sizeof(long int)); printf("Size of long long: %lu bytes\n", sizeof(long long)); + printf("Size of float: %lu bytes\n", sizeof(float)); + printf("Size of double: %lu bytes\n", sizeof(double)); + printf("Size of long double: %lu bytes\n", sizeof(long double)); + + /* + * Output in linux x64 + * Size of char: 1 bytes + * Size of short: 2 bytes + * Size of int: 4 bytes + * Size of long: 8 bytes + * Size of long int: 8 bytes + * Size of long long: 8 bytes + * Size of float: 4 bytes + * Size of double: 8 bytes + * Size of long double: 16 bytes + */ return 0; }