坑爹的数组名!

 输出结果是:

  
  
  
  
  1. #include<iostream> 
  2. #include<cassert> 
  3. using namespace std; 
  4. int getSize(int a[10]) 
  5.      return sizeof(a); 
  6. void main() 
  7. int a[10]; 
  8. int *b; 
  9. b = a; 
  10.  
  11. int (*c) [10]; 
  12. c = &a; 
  13. cout<<"a "<<a<<" size:"<<sizeof(a)<<endl; 
  14. cout<<"a+0:"<<a+0<<"  size:"<<sizeof(a+0)<<endl; 
  15. cout<<"b:"<<b<<"  size:"<<sizeof(b)<<endl; 
  16. cout<<"c: "<<c<<"  size:"<<sizeof(c)<<endl; 
  17. cout<<"getSize of a: "<<getSize(a)<<endl; 
  18. system("pause"); 

你可能感兴趣的:(C++,数组,指针,休闲,坑爹)