void Test(int a[]) { a[5] = 3; }
只是替代语法:
void Test(int* a) { *(a+5) = 3; }
没有数组传递,只是一个指针.原始数组已修改.
至于你的第二次修订,给出:
void Test(int a) { } void Best(int &a) { }
然后
Test(aa); // Passes aa by value. Changes to a in Test() do not effect aa Best(aa); // Passes aa by reference; Changes to a DO effect aa Best(&aa); // Is a syntax error: Passing a pointer instead of an int.