-
Notifications
You must be signed in to change notification settings - Fork 4
/
sizeof_example.cpp
23 lines (21 loc) · 1.05 KB
/
sizeof_example.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
using namespace std;
int main() {
cout << "the size of bool is " << sizeof(bool) << '\n';
cout << "the size of bool* is " << sizeof(bool*) << '\n';
cout << "the size of char is " << sizeof(char) << '\n';
cout << "the size of char* is " << sizeof(char*) << '\n';
cout << "the size of short is " << sizeof(short) << '\n';
cout << "the size of short* is " << sizeof(short*) << '\n';
cout << "the size of int is " << sizeof(int) << '\n';
cout << "the size of int* is " << sizeof(int*) << '\n';
cout << "the size of long is " << sizeof(long) << '\n';
cout << "the size of long* is " << sizeof(long*) << '\n';
cout << "the size of long long is " << sizeof(long long) << '\n';
cout << "the size of long long* is " << sizeof(long long*) << '\n';
cout << "the size of float is " << sizeof(float) << '\n';
cout << "the size of float* is " << sizeof(float*) << '\n';
cout << "the size of double is " << sizeof(double) << '\n';
cout << "the size of double* is " << sizeof(double*) << '\n';
return 0;
}