#include <iostream>
using namespace std;
void f(char str[]) {
cout << sizeof(str)<<endl;
}
// error C2084: 函数“void f(char [])”已有主体
void f(char str[100]) {
cout << sizeof(str) << endl;
}
int main()
{
char str[] = "http://www.bilibili.com/";
char* p = str;
int n = 10;
cout << sizeof(str)<<endl;
cout << sizeof(p) << endl;
cout << sizeof(n) << endl;
char s[100];
cout << sizeof(s) << endl;
f(str);
f(s);
void *tp = malloc(100);
cout << sizeof(tp) << endl;
return 0;
}
x86输出:
25
4
4
100
4
4
4
x64输出:
25
8
4
100
8
8
8