473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How elements are stored in an array

can i ask how are elements of an array stored in an memory?
Jul 6 '07 #1
1 1835
weaknessforcats
9,208 Expert Mod 8TB
It is required that the elments be contiguous in memory. Otherwise, pointer calculations are not possible.

All arrays are one-dimensional.

int array[4]; //4 elements each element an int

is stored

0 1 2 3

int array[4][2]; //4 elements with each element an array of 2 int

0 1 0 1 0 1 0 1
0 1 2 3

The first index is the number of elements. Any other indexes just describe the element.
Jul 6 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

34
by: Adam Hartshorne | last post by:
Hi All, I have the following problem, and I would be extremely grateful if somebody would be kind enough to suggest an efficient solution to it. I create an instance of a Class A, and...
4
by: WindAndWaves | last post by:
Hi Gurus I have the following statement in my code: var e = form.elements; Is it possible to put any conditions on this statement. What I actually want to say is: var e = form.elements...
2
by: Abby | last post by:
From my code below, it will open a file specified in argv, then read line by line and store each line in an array call IPTemp. After reading until EOF, it will return array IPTemp to main, which...
18
by: zehanwang | last post by:
Compiler: Visual C++ 6.0 My code: //============================== # include "stdio.h" # include "stdlib.h" int main() { int v; long i; for (i=1; i<=10000000; i++) v =i;
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
4
by: Ole Nielsby | last post by:
I need to build a small array of pointers to a type MyType. The array size can be from 1 upwards, is not known beforehand, typically < 10 but I don't want a small fixed limit. Elements will be...
12
by: neeraj | last post by:
Hi Can any body give me the syntax for summing the elements of the an array , without looping thanks
3
by: jonniethecodeprince | last post by:
Hi all, I have trouble getting an array of data stored in a separate javascript file i.e. a file called books.js into a table of data for a .xhtml file. There are 50 Records in this file....
11
by: C C++ C++ | last post by:
Hi all, got this interview question please respond. How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Rgrds MA
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.