r/C_Programming • u/Yelebear • Sep 14 '26
Question Question about arrays (beginner)
From what I understand, behind all the magic, array is just a variable that points to a memory address.
The difference is that we are also creating extra values in stack.
So when we create an array with a [], we're just telling the computer to make these x amount of variables but make sure they are right next to each other in sequence, no gaps in the memory address.
And when we call for an array value with an index, we're just counting that many steps forward in the memory address.
When we say array[] = {5,7,3}, it's really just *array = 5.
Did I get it wrong? Did I miss something?
Thanks for the quick replies. I'm currently learning about Pass by reference.
View all comments
Show parent comment
0
u/NYU_VM Sep 15 '26 edited Sep 15 '26
May God help your students then. And to speak in your terms, sizeof isn't an operator either. Plus it is a standard n1256 defined exception that array behave like so when sizeof is called upon them because the compiler distinguishes what you're inspecting is part of an array(a pointer to an array of data) and not a regular pointer.