void arraysum (int a[],int b[])
{
cout < < "sizeof (a)" < <sizeof (a) < <endl;
cout < < "sizeof (A[0])" < <sizeof (int) < <endl;
int length_a = sizeof (a)/sizeof (int);
}
Equivalent to:
void arraysum (int *a,int *b)
{
cout < < "sizeof (a)" < <sizeof (a) < <endl;
cout < < "sizeof (A[0])" < <sizeof (int) < <endl;
int length_a = sizeof (a)/sizeof (int);
}
Recently wrote a few small functions, useful to the array name as a parameter of the case, here to record the learning process.
Some knowledge: http://www.cnblogs.com/c-king/archive/2009/03/05/1404202.html
The parameters of the array masterpiece function must follow the following guidelines:
(1) If the formal parameter is an array, the argument must be the actual array name, and if the argument is an array name, then the parameter can be an array name or a pointer to the same number of dimensions.
(2) To define the array separately in the keynote function and the modulated function.
(3) The real parameter group and the parameter group must be of the same type, and the parameter group can not indicate the length.
(4) in the C language, the array name, except as the identifier for the variable, the array name also represents the starting address of the array in memory, so when the array masterpieces function argument, the actual participating parameter is not "value pass", but "address delivery", and the real parameter group name is passed the starting address of the array to the form parameter group. Two arrays share a memory unit, and the compilation system no longer allocates storage units for the parameter groups.