# Thread: Question in arrays and pointers

1. ## Question in arrays and pointers

Code:
```  1.#define ROWS 9
2.#define COLUNMS 9

3.char grid[ROWS][COLUNMS] = {{0,0,'B',     'A','D',0     ,'H','F',0},
{'D',0,'H', 'B','E',0     ,0,0,0},
{'A','G',0, 'C',0,0     ,0,0,'D'},

{0,'A',0,     0,0,0 ,0    ,'G','F'},
{'F',0,'E', 'G',0,'B'     ,'C','D','A'},
{0,'I',0,     0,0,0 ,0    ,'B','H'},

{'E','B',0, 'I',0,0     ,0,0,'G'},
{'H',0,'F', 'E','G',0     ,0,0,0},
{0,0,'G',     'H','B',0     ,'F','C',0}};

4.char * gridPtr = &grid[0][0];```
I am confused of what line 4 means. I think that gridPtr is the address of the array named grid and *gridptr is 0. Is this right or not?

2. Excactly. You've no reason to be confused, you absolutely got it.
The pointer to an array is always the address of the very first element of the array regardless of its dimensions. In your example that is put by using the »&« operator employed on the element grid[0][0] which is the very first element. Caused by the fact that »grid« already is a pointer to the array the expression »&grid[0][0]« is equal to just »grid« and line 4 could also be done as »char *gridPtr = grid«.

3. I'm not sure if you did this on purpose but Columns is misspelled and it's bugging the heck out of me.

4. Originally Posted by Cdd101
I'm not sure if you did this on purpose but Columns is misspelled and it's bugging the heck out of me.
No, it was by mistake.