Get the values in a two-dimensional array through array pointer : Multi Dimensional Array Pointer « Array « C Tutorial






#include <stdio.h>

int main(void)
{
  char board[3][3] = {
                       {'1','2','3'},
                       {'4','5','6'},
                       {'7','8','9'}
                     };


  int i;
  for(i = 0; i < 9; i++)
    printf(" board: %c\n", *(*board + i));
  return 0;
}
board: 1
      board: 2
      board: 3
      board: 4
      board: 5
      board: 6
      board: 7
      board: 8
      board: 9








7.11.Multi Dimensional Array Pointer
7.11.1.Two-Dimensional arrays and pointers
7.11.2.Two-Dimensional arrays: pointer of pointer for its element
7.11.3.Get the values in a two-dimensional array through array pointer
7.11.4.Get values from multidimensional arrays with pointers
7.11.5.Declaration of outer block and inner block