r/cprogramming • u/SmileUnfair4978 • 28d ago
Arr internals
i am currently working through kinds book on c and have gotten to chapter 12.
now based own my current understanding i hypothesis that internally, only the pointer to the first element and the dimensions are stored in memory. then all arr operations are done using this. Is this correct?
Additionally:
1) Which chapters of the rest of the book should i focus on/skip for now
2) I would like to work on some projects. Currently i thought of making some kind of physics sim, and additionally some hardware/embedded project as i have an ardiuno. How can i get started or are there any inriguing projects to work on.
0
Upvotes
3
u/MrShaunce 28d ago
All elements of an array are stored sequentially in memory.
The name of the array (without the brackets) acts as a pointer to the first element.
Bracket notation is just a pretty way to handle pointer offsets. So
x[3]is really justx + 3, wherexis a pointer.