
122 Introduction to Computational Modeling
j,
*
intptr);
11 intptr++; /
*
point to next element of array myarray
*
/
12 }
13 return 0;
14 } /
*
end function main
*
/
After compiling, linking, and executing the program, the following output is dis-
played:
$ gcc -Wall incrptr.c
$ ./a.out
Current element: 0 value: 10
Current element: 1 value: 20
Current element: 2 value: 30
Current element: 3 value: 40
Current element: 4 value: 50
9.8 Arrays as Pointers
In the previous section it was shown that an array can be manipulated as a pointer.
This is useful when using array parameters and when an array is the return value in
a function.
9.8.1 Pointer Parameters for Arrays
An array ...