Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In C language, how do arrays pass values as function parameters?
In C language, how do arrays pass values as function parameters?
Pass the array to the function, and the array type is automatically converted to the pointer type, so the actual address is passed.

void func(int array[ 10])

void func(int array[])

void func(int *array)

So the above three function declarations are completely equivalent.

In fact, arrays as parameters cannot be passed by values at all. This is determined by the implementation mechanism of C/C++ function.

The next question is: Why must we pass by value? When you want to use an array in a function, just pass in a pointer. As long as we can access the data we want and operate it, why go into a dead end?