Solved

An Array, Letters, Has Been Declared and Initialized as Follows

Question 61

Essay

An array, letters, has been declared and initialized as follows:
char [ ] letters = { 'A', 'B', 'A', 'C', 'E', 'D' };
What is the index of C?
What is the array element at index 1?
Swap the value at indexes 3 and 5 (C and D) without knowing what the values are. After the swap, the array will look like A B A D E C.
Using a loop, assume that you do not know how many elements are in the array and the contents of the array, and compute and output how many As are in the array letters.
Using a loop, assume that you do not know how many elements are in the array and the contents of the array, and change all the As of letters into Zs; do not change the other letters.

Correct Answer:

verifed

Verified

The index of C is 3.
The array element a...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions