64位系统
/* Online C++ Compiler and Editor */
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
//6
char str[] = "strln";
cout << sizeof(str) << endl;
//100
char str100[100] = "strln";
cout << sizeof(str100) << endl;
//8任何指针类型都是8,包括void*
char* p = str;
cout << sizeof(p) << endl;
int n = 0;
int* pInt = NULL;
// 4 8
cout << sizeof(n) << " " << sizeof(pInt) << endl;
//8
void* pMalloc = malloc(100);
cout << sizeof(pMalloc) << endl;
//1
cout << sizeof(bool) << endl;
//1
cout << sizeof(char) << endl;
//4
cout << sizeof(wchar_t) << endl;
//2
cout << sizeof(short) << endl;
//4
cout << sizeof(int) << endl;
//4
cout << sizeof(float) << endl;
//8
cout << sizeof(double) << endl;
//8
cout << sizeof(long) << endl;
return 0;
}
64位和32位系统区别