C - Pointer Notation and Array Notation

Introduction

Pointer Notation
Array Notation
Description
**ptr
*array[]
Declares an array of pointers.
*ptr

array[0]

The address of the first pointer in the
array; for a string array, the first string.
*(ptr+0)
array[0]
The same as the preceding entry.
**ptr


array[0][0]


The first element of the first pointer in
the array; the first character of the first
string in the array.
**(ptr+1)


array[1][0]


The first element of the second pointer
in the array; the first character of the
second string.
*(*(ptr+1))


array[1][0]


The first element of the second pointer
in the array; the first character of the
second string.
*(*(ptr+a)+b)
array[a][b]
Element b of pointer a.
**(ptr+a)+b


array[a][0]+b


What this item represents is the value of
element 0 at pointer a plus the value of
variable b. Use the *(*(ptr+a)+b) notation instead.

Related Topic