#Meta-Wlp: #Macro: TITLE wlp: Learn C (IV) p. 10
Int-star is a reference to an integer. In the case of passing arrays to functions, it is a reference to a sequence of integers. By using *(a+i) or a[i] we can get the i-th integer in the sequence, counting from zero as the first in the sequence.
To emphasize this intended meaning, we could say int z[], an array of unspecified dimension, rather than int * z, in the function count_backwards.
Exercise: Explain how this program works.
#include<stdio.h> int count_backwards( int z[], int ip[] ) { int i = 0 ; while (z!=(ip+i)) printf("%d, ", ip[i--] ) ; printf("%d\n",ip[i]) ; } int main(){ int my_count[3] ; my_count[0] = 0 ; my_count[1] = 1 ; my_count[2] = 2 ; count_backwards( my_count, my_count+2 ) ; }Exercises
#includeint copy_characters( char s[], char t[] ) { /* you do the work */ } int main() { char * s ; char t[16] ; /* 15 characters + end-of-string marker */ s = "You do the work" ; copy_characters( s, t ) ; }