Arrays simply indicate an arbitrary amount of memory. If you make sizeof (an array), it will return the size of the pointer - 4 bytes on 32-bit systems and 8 bytes on 64-bit systems (if the program is compiled as a 64-bit version).
This is the same reason you need to zero out the end of lines in c / C ++ - to mark the end of an array.
Simply put, you yourself track the size of your arrays. If you allocate an array of 40 bytes, you should make sure that you never get access to the array above the 40th index (ie Array [39]).
Hope this helps.
source share