< previous page page_603 next page >

Page 603
int x[50];
int y[50];
there is no aggregate assignment of y to x:
x = y;    // No
To copy array y into array x, you must do it yourself, element by element:
for (index = 0; index < 50; index++)
    x[index] = y[index];
Similarly, there is no aggregate comparison of arrays:
if (x == y)    // No
nor can you perform aggregate I/O of arrays:
cout << x;     // No
or aggregate arithmetic on arrays:
x = x + y;     // No
(C++ allows one exception for I/O, as we discuss in Chapter 12. Aggregate I/O is permitted for strings, which are special kinds of char arrays.) Finally, it's not possible to return an entire array as the value of a value-returning function:
return x;     // No
The only thing you can do to an array as a whole is to pass it as a parameter to a function:
DoSomething(x);

 
< previous page page_603 next page >