sizeof和数组名的问题
cimil 2007-01-25 08:54:44 sizeof运算符和数组名的问题
先看代码:
#include <iostream>
using namespace std;
void theFun(char a[])
{
cout<<"2:"<<sizeof(a)<<endl;
}
int main()
{
char a[100]="";
cout<<"1:"<<sizeof(a)<<endl;
theFun(a);
return 0;
}
程序的输出结果为:
1:100
2:4
我的问题:为什么两次输出结果不一样?