5.3 Pointers and Arrays
- a[i] can also be written as *(a+i); &a[i] = a+i
- A pointer is a variable, so pa = a and pa++ is legal
- An array name is not a variable, so a = pa and a++ is illegal
- When an array name is passed to a function, what is passed is the location of the initial element
- Within the called function, this argument is a local variable, and so an array name parameter is a pointer(variable containing an address)
- As formal parameters in a function definition, char s[] and char *s are equivalent
- It is possible to pass part of an array to a function, by passing a pointer to the beginning of the subarray
No comments:
Post a Comment