The C language allows pointer addition and subtraction. Let’s take a look at this example:
char array[10];
char *ptr_toarray = &array[0];
In this example we declare an array with ten elements. Then we declare that the pointer *ptr_toarray is the same as array[0] (the same as the first element of the array). Now we could do the following (note the placing of the parentheses):
*(ptr_toarray + 2);
This is the same as array[2]. So you can see, the C language allows arithmetic’s. But remember to place the parentheses very carefully. ( *(ptr_toarray + 2); is something different then *(ptr_toarray) + 2; ).