|
| |
Some rules when using arrays:
- You need to declare the array: type, name and size
- In a function header the size is not relevant, but you still need to use
the [] so that the compiler knows this is an array.
- You cannot perform any operation (=, +, -, *, /, == etc.) with the whole
array:
- ex. array1=0; // don't do that!
- You can only perform operations with EACH element of the array
- ex array1[k]=0; // this is ok
- Never use the array with an empty bracket
- Notice that, whenever you have an array followed by an index (in
brackets) then you don't have an array, you have one ELEMENT of the array.
|