输出结果是:
- #include<iostream>
- #include<cassert>
- using namespace std;
- int getSize(int a[10])
- {
- return sizeof(a);
- }
- void main()
- {
- int a[10];
- int *b;
- b = a;
- int (*c) [10];
- c = &a;
- cout<<"a "<<a<<" size:"<<sizeof(a)<<endl;
- cout<<"a+0:"<<a+0<<" size:"<<sizeof(a+0)<<endl;
- cout<<"b:"<<b<<" size:"<<sizeof(b)<<endl;
- cout<<"c: "<<c<<" size:"<<sizeof(c)<<endl;
- cout<<"getSize of a: "<<getSize(a)<<endl;
- system("pause");
- }