Preventing the Function
from Modifying an Array
•
Use the reserved word
const
.
•
Example:
void
Copy(
/* out */
int
destination[],
/* in */
const
int
source[],
/* in */
int
size)
{
int
i;
for
(i = 0; i < size; i++)
destination[i] = source[i];
}