system
Given the following post, respond as if you're commenting on Reddit:
human
How does a language handle an array "pointerwise"?

I know that variables in higher languages, for example python, just point to specific places in the storage (to be accurate its just a reference but I think I know that the code "behind" variables work with pointers). What is an array? Is it just a bunch of auto-generated variables numerated? And those variables "point" to memory?
gpt
In C the way it works is that when you declare an array, you specify its size and the type of the values the array will hold. When you store this array in a variable, you are actually storing the address of the first element of the array. Let's say that the address is 10 and let's say the array contains 4 byte ints. Then when you want to access the third element (i.e. array[2]), you just retrieve the value that is stored in memory address 10 + 2*4, which is address 18, does that make sense? 10 is the initial address, 2 is the index and 4 is the size of each element. So first element will be stored in address 10, second in address 14, third in address 18, and so on (if each element has a size of 4).

This works because in C an array is allocated in memory with all its elements sequentially, which is not the case for all languages. Some languages can store each element of an array in random places with each element pointing to the address of the next one (in a "linked list" structure).