Summary:
When you call a function that has parameters, you need to provide an actual participation. An actual participation can be a constant, variable, or expression.
An array element acts as a variable.
An array element can be used as a function, and its method is the same as a variable. Passes the value of the array element to the shape. The array name can also be used as an actual and formal participation, passing the first address of the array.
An array element can be used as a function, but not as a form.
Because the shape participates in the function call temporarily allocates the storage unit. It is not possible to allocate a storage unit independently for an array element (an array is a population, which occupies a contiguous storage unit in memory). When an array element is used as a function, the actual participation is passed to the formal participation. Is the "value pass", the data passing direction is to participate in the formal participation. One-way delivery.
#include <stdio.h>int max (int x,int y) {return (x>y?X:Y);} int main () {int a[10];int i,m,n;for (i=0;i<10;i++) scanf ("%d", &a[i]), for (i=0,m=a[0];i<10;i++) {if (max (m,a[i ]) >m) {m=a[i];n=i;}} printf ("The largest number is%d\nit is The%dth number\n", m,n+1); return 0;}
Enter 10 numbers to find out the number of the largest element (array as function parameter)