C++ Array two dimensional array and pointer

Description

C++ Array two dimensional array and pointer

#include <iostream>
const int ROWS = 2;
const int COLS = 3;
void arr(int [] [COLS]);
int main()/*from ww  w.j a v a 2 s. c  o m*/
{
   int nums[ROWS][COLS] = { {3,1,2}, {4,7,9}};
   arr(nums);
   return 0;
}
void arr(int (*val) [3])
{
   cout << endl << *(*val);
   cout << endl << *(*val + 1);
   cout << endl << *(*(val + 1) + 2);
   cout << endl << *(*val) + 1;
   return;
}



PreviousNext

Related