Can someone help? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can someone help?

Fill in the blanks to print to the screen the first and the last elements of an array with a size of 5. cout << arr[__] << endl; cout << arr[__] << endl;

24th Sep 2021, 3:43 PM
Stella
Stella - avatar
1 Answer
+ 8
Arrays are zero-indexed, meaning the first element has the index 0 and the last element has the index size - 1, where `size` would be the size of the array, meaning an index of 4 for an array of five elements. When you have trouble solving one of the course questions, try reviewing the lessons before it first. They usually contain the answer to the problem.
24th Sep 2021, 3:48 PM
Shadow
Shadow - avatar