Item06. Array Formal Arguments
Cautious use
---------------------------------------- Decay: Array Automatically Convert to point to its head of the first element
---------------------------------------------
1. When using an array as a function of the function, the boundary information of the array is lost, so there is no need to specify the size of the array. Void average (int ary []); // int * ary
2. To explicitly specify the size of the array group, use reference Void Average (int (& ary) [12]); // can only be incorporated into an INT array of size 12
More access, you can use Templates: Template
3, traditional method void average_n (int ary [], int size);
4, use STL containers, such as Vectorvoid Average (std :: vector
5, multi-dimensional array is involved in a one-dimensional array of groups, but the array degradation is an array of arrays. Void Process (int ary []); // int (* ary) [20]
Template