What is the value assigned to arr[2] in the following array initialization?
int arr[5] = {25,30,40,50,60};
Answers
Answered by
2
Answer:
Given array,
>> arr[] = {25, 30, 40, 50, 60}
>> arr[2] = 40 (Answer)
Explanation:
Note that - Array index starts with 0 and ends with (array_length - 1).
Now, let us write the index of the given array elements.
→ From the figure, we can see that the element at index 2 is 40.
→ Therefore, 40 is stored in index 2 of the given array.
Learn More:
- Array: An array is a variable which can store more than one value at a specific time. It stores values of particular data type.
- There are two types of arrays - Static array and Dynamic array.
Similar questions