/* * Example of formal array arguments * use the declaration: int list[] */ #include #define NSIZE 10 void fill_array(int list[], int n, int in_value); int main() { int x[NSIZE], y[NSIZE], i, num = 1; fill_array(x, NSIZE, num); printf("array x = "); for (i=0; i < NSIZE; ++i) printf(" %d", x[i]); printf("\n"); /* equivalently, .... */ fill_array(&y[0], NSIZE, num); // since C stores the addres of ... but may confuse with using // only the array element x[0] as an output arguments printf("array y = "); for (i=0; i < NSIZE; ++i) printf(" %d", y[i]); return 0; } /* ........ */ void fill_array(int list[], int n, int in_value) { int i; for (i = 0; i< n; ++i) list[i] = in_value; }