...
| Code Block |
|---|
int *p = dis;
for (i = 0; i < ARRAY_SIZE; i++) {
*p = 42; //* Assigns 42 to each element;*/
p++;
}
|
The variable p is declared as a pointer to an integer and then incremented in the loop. This technique can be used to initialize both arrays and is a better style of programming than incrementing the pointer to the array because it does not change the pointer to the start of the array.
...