By definition, an array is a data structure that can store multiple values of the same type. Each value in an array is called an element, and the elements are accessed by their index position within the array.
One common question that arises when working with arrays is: What is the default value of an array? In other words, if no value is explicitly assigned to an element in an array, what value will it hold?
The default value of an array depends on the type of the elements it holds.
The following are the default values for different types of arrays:
1. What is the default value of an array of integers?
The default value of an array of integers is 0.
2. What is the default value of an array of floating-point numbers?
The default value of an array of floating-point numbers is 0.0.
3. What is the default value of an array of characters?
The default value of an array of characters is the null character (‘