Advertisements
Advertisements
Question
The index (subscript) of the last element of an array ar[ ] is ______.
Options
ar.length( )ar[ ].lengthar.length()-1ar.length-1
MCQ
Fill in the Blanks
Advertisements
Solution
The index (subscript) of the last element of an array ar[ ] is ar.length-1.
Explanation:
ar.length gives the last position, and -1 gives the actual index, as the index of the array starts from 0 to n-1.
shaalaa.com
Is there an error in this question or solution?
2024-2025 (March) Official Board
