关于数组

下面两个声明是等同的,注意二维数组的声明方法,尤其是第一种方法。

 // first parameter is an array whose elements are arrays of 10 ints
     void printValues(int (matrix*)[10], int rowSize);

 // first parameter is an array whose elements are arrays of 10 ints
     void printValues(int matrix[][10], int rowSize);

declares matrix to be what looks like a two-dimensioned array. In fact, the parameter is a pointer to an element in an array of arrays. Each element in the array is itself an array of ten ints

 
下面两个再记一下:   

      int *matrix[10];   // array of 10 pointers

     int (*matrix)[10]; // pointer to an array of 10 ints

阅读更多

没有更多推荐了,返回首页