void PrintArray (int arr[], int size)
{
int i;
for (i = 0; i < size; i++)
printf("%d ", arr[i]);
}
Note that:
int list[5] = {2, 4, 6, 8, 10};
PrintArray(list, 5); // will print: 2 4 6 8 10
void PrintArray (const int arr[], const int size)
{
int i;
for (i = 0; i < size; i++)
printf("%d ", arr[i]);
}
Notice that the const on the variable size is a good
idea in this example, too. Why?