Exforsys

Free Training

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? ...

Go Back   Exforsys > Programming Talk > C and C++

Exforsys.com


C and C++ C and C++

Reply

 

LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 04-07-2006, 01:49 PM
Junior Member
 
Join Date: Jan 2006
Posts: 21
Charith is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-07-2007, 08:06 AM
Senior Member
 
Join Date: Apr 2006
Posts: 144
caradoc is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-07-2007, 08:33 AM
Senior Member
 
Join Date: Apr 2006
Posts: 141
Adrian is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 11:26 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
Copyright 2004 - 2009 Exforsys Inc. All rights reserved.