当函数具有特定大小的数组参数时,为什么要用指针替换它?
#include <iostream>using namespace std;void foo( char a[100] ){ cout << "foo() " << sizeof( a ) << endl;}int main(){ char bar[100] = { 0 }; cout << "main() " << sizeof( bar ) << endl; foo( bar ); return 0;}
main() 100foo() 4
UYOU
慕桂英546537