Pointers and Arrays Notes

When an array is used as a function parameter, it will degenerate into a pointer
int a[10] -=-->int a[] ---->int *a  

When an array is used as a function parameter, if the inta[10] statement is defined in the formal parameter,

The c/c++ compiler will optimize, and the technical deduction is as follows

int a[10]-=-->int a[] ---->int *a 

Summary: When a function is called, it is the most correct way to pass the first address of the array and the length of the valid data to the called function.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325808370&siteId=291194637