Fixed-size array

We’ve had variables to store data of specific primitive types and to perform powerful tasks like arithmetic operations and several control structures involving conditions and loops. However, this method has its limitations, as we’re only able to store a single data value in each variable. This becomes a problem when we need to maintain data with more than one value. The common solution of using multiple variables is not efficient when we need to search for a specific element. To overcome this issue, we’ll introduce fixed-size arrays.

In an array, contiguous blocks of a fixed length are allocated in the memory.

Get hands-on with 1200+ tech skills courses.