Exforsys
+ Reply to Thread
Results 1 to 3 of 3

Array Internals

This is a discussion on Array Internals within the C and C++ forums, part of the Programming Talk category; I want to know more about array internals, can anyone tell me how an array is actually stored in memory? ...

  1. #1
    Charith is offline Junior Member Array
    Join Date
    Jan 2006
    Answers
    12

    Array Internals

    I want to know more about array internals, can anyone tell me how an array is actually stored in memory?

    Thanks in advance.


  2. #2
    caradoc is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    122
    It is a interesting fact you have asked. When a programmer declares an array say as
    int exforsys[100]
    then the compiler allocates contiguous memory locations for the number of elements specified. In C and C++ the size of each item depends upon the data type of the array elements. For instance as given in example before exforsys is the array name of type int having 100 locations requested so each item would occupy 4bytes of memory and so 100 contiguous memory locations each of 4 bytes size would be allocated.

    This is the process of array getting stored in memory internally.


  3. #3
    Adrian is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    124
    This was really a fantastic explanation given. caradoc thanks for such a detailed reply. I am sure everyone reading this would surely find it very useful. Keep posting such useful information for us.


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...