Getting values in a two-dimensional array with pointer - C Pointer

C examples for Pointer:Array Pointer

Description

Getting values in a two-dimensional array with pointer

Demo Code

#include <stdio.h>

int main(void)
{
  char board[3][3] = {
                       {'1','2','3'},
                       {'4','5','6'},
                       {'7','8','9'}
                     };//from   w  w w . j ava 2 s.c  o  m

  // List all elements of the array
  for(int i = 0 ; i < 9 ; ++i)
  printf(" board: %c\n", *(*board + i));
  return 0;
}

Result


Related Tutorials