+1

Memory allocation for a single array with multiple values

A curious learner here. “you can declare a single array to store all the values.” so if a single array can store multiple values, those values are going to be stored some where in a memory location, then the question is are all those values gonna be stored under one big memory location that was allocated for the array variable and then subdivide that space for each value? Or they all in one big memory location and no subdivided memory location?

10/21/2019 7:59:02 PM

Shiine

2 Answers

New Answer

+3

A big memory block is allocated first of size equal to sizeof(type) * Number of elements. Then the memory is divided equally between each elements, that is why each element has different addresses, but all these are linedup sequentially in one contiguous memory block.

+1

@~swim~ thanx man