title: how do arrays work internally in c/c++
body: <p>I was wondering how do arrays work in c. I end up with an hypothesis and I'd like to know if I am right or not.</p>
  
  <p>We know arrays are a sequence of adjacent memory cases(boxes), where each box has the size of the type it stocks (i.e if  INTs one box has a size = sizeof(int) and an array of 3 INTs takes in memory adjacent places of 3 sizeof(int) )</p>
  
  <p>Now we also know that we can dynamically allocate memory for an array of a certain type (malloc in C, new in C++).</p>
  
  <p>what makes me wonder is the fact that an array has for origin the the address of the first box of the array and the first value (the value in the later box) when calling it with the bracket [0] is array[0] == *(array+0) == *array (whether array was declared "type * array" or "type array[]" or "type array[size]")  and "array"  called that way whether define as a pointer or an array ("type * array" or "type array[]" or "type array[size]") is the address of the first box.</p>
  
  <p>I end up thinking and I'd like a confirmation on this: arrays when even declared with the square brackets ([]) are actually in memory a sequence of n pointers each containing (having as a value not as an address) the address of a memory box Bi containing the actual value + those memory boxes (B0,...,Bn each containing the actual values). such that in the and when one declares "int array[5]" the program actually allocate 5 adjacent boxes of int pointers P0,P1,..,P4 and 5 int sized memory places scattered all over the computer memory B0,B1,...,B4 where the value of Pi is the address of Bi</p>
  
  <p><img src="https://i.stack.imgur.com/oZl07.png" alt="enter image description here"></p>
  
  <p>Am I right or wrong!!?? Thank you!</p>