Next: Exercises
Up: Arrays
Previous: Summary
a4 and a[4]?
day is declared as follows:
int day[] = {mon, tue, wed, thu, fri};
How many elements has the array day? If the declaration is
changed to
int day[7] = {mon, tue, wed, thu, fri};
how many elements does day have?
int A[5] = {1 , 2, 3, 4};
int i;
for (i=0; i<5; i++)
{
A[i] = 2*A[i];
cout << A[i] << " ";
}
int A[10], i; for (i=1; i<=10; i++) cin >> A[i];
n elements of an array. If the function was amended so that it
would return false if n was larger than the size of
the array how should the function heading be written? If the function
was to be changed so that a new array was produced each of whose
elements were double those of the input array how would the heading be
written?