October 2011
Beginner to intermediate
1200 pages
35h 33m
English
You can use increment operators with pointers as well as with basic variables. Recall that adding an increment operator to a pointer increases its value by the number of bytes in the type it points to. The same rule holds for incrementing and decrementing pointers:
double arr[5] = {21.1, 32.8, 23.4, 45.2, 37.4};double *pt = arr; // pt points to arr[0], i.e. to 21.1++pt; // pt points to arr[1], i.e. to 32.8
You can also use these operators to change the quantity a pointer points to by using them in conjunction with the * operator. Applying both * and ++ to a pointer raises the questions of what gets dereferenced and what gets incremented. Those actions are determined by the placement ...
Read now
Unlock full access