c++ - typedef and multi-dimensional array -




    #include <iostream>     using namespace std;      typedef int array[2];      int sum(array a[], int n)     {         int sum = 0;          for(int = 0; < 2; i++)            for(int j = 0; j < n; j++)               sum += a[i][j];          return sum;     }      int main()     {         int n = 2, sum;         array a[n];          for(int = 0; < 2; i++)            for(int j = 0; j < n; j++)                a[i][j] = * n + j;          cout << sum(a, n) << endl;          return 0;     } 

it use typedef in global scope? use typedef declare multi-dimensional array, instead of a[][]?





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -