- It is not possible to perform aggregate operations on arrays in C++
- You can't assign an entire array to another array, nor can you add to an entire array at once
- You can pass an entire array to a function; that is the major purpose of using just the array name
Assume you have arrays, a, b, and c:
int a[10], b[10], c[10];
You cannot do any of these operations:
1. a = b // can't assign one to another
2. if (a == b) // can't compare
3. c = a + b // can't add, sub, mult, divide
4. cout << a // can't output entire array
5. return a // can't return an array
You must perform the operation on each element individually. For example, array assignment:
for (int i = 0; i < 10; i++)
a[i] = b[i];
If you had a function that could sort an array of integers, you could pass an entire array by passing the name of the array:
sortArray(a); // the entire array is passed in