And references cited an array of arrays

If you have this problem, the language barrier is not converted blame computer invented in China.

First, the array reference: this is a wrong definition.

int array[2]={1,2};

int &a[2]=array;

What is a reference, is popular speak aliases, and we know that the array may be a pointer (but in fact is the object), we can pass a statement to define another pointer to fully implement this function.

Second, an array of references:

int (&a)[2]=array;

Legitimate, in fact, also 2 as a parameter, indicating that there are two elements.

C ++ or feeling from both of them chose a? Anyway, keep in mind that the second is correct

Guess you like

Origin www.cnblogs.com/working-in-heart/p/12322433.html