Re: C programming Arrays

Hi John,

Arrays come in up to three dimensions. A one dimensional or single dimensioned 
array is like a list or a stack of open ended boxes into which values may be 
stored. A two dimensional array is like a collection of boxes or pigeon holes, 
that is you have rows and columns of boxes into which you can stuff values. 
Three dimensional arrays are like layers of pigeon holes stacked in front of 
each other into which values may be stuffed and retrieved. When you want to 
stick something into a particular array location you must specify which one. 
For example:

Pigeon hole [1 down], [two to the right], [three deep]
in the case of a three dimensioned array.

In the case of a single dimension array which is more like a list you might 
retrieve the item in list [12].

If you were modeling a checker board it would be a two dimension array, 
CheckerBoard[8],[8].

The various dimensions then are referred to as indexes and may be referred to 
using integer variables so you can use a loop to loop through each index of an 
array to read from the location or write to it or change it or what ever. The 
trick there is to remember which index you are referencing, that is, to read in 
sequence you probably want to set x to one then loop through y then increase x 
and again loop through y until you have visited all of the x/y index locations.

Is that the sort of thing you were looking for?

You must specify the sort of variable you are storing, you can have arrays of 
strings, integers, doubles and floats but you cannot mix them. You can however 
have an array of strings say to hold names and a similar array of floats to 
hold wages and index both with the same value so that:

NameString[1] is an employee name and WageFloat[1] is his wage. Different 
arrays but linked by their index. Your programme must take care not to confuse 
the index or you may be pointing to someone else's wages.

Hope I understood your request and that this was helpful.

Dale Leavens, Cochrane Ontario Canada
DLeavens@xxxxxxx
Skype DaleLeavens
Come and meet Aurora, Nakita and Nanook at our polar bear habitat.


----- Original Message ----- 
From: "John Miller" <n1umj@xxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, October 09, 2007 5:30 PM
Subject: C programming Arrays


> Hi,
> Is there anyone that can give a good, actually reasonably understandable 
> explanation or example of an array in C programming? In my class, the book's 
> examples are horrible at best and confusing and the teacher should be fired 
> his is so bad. That or I should drop the class which I was actually about to 
> do but I looked and there is no other major completely online that holds my 
> interest so I guess I have to stick it out for another torturous 5 weeks or 
> what ever it is. I'm getting some of it, but not enough.
> Thanks,
> John Miller N1UMJ
> AIM and yahoo messenger: N1UMJ Skype: n1umjjohn
> home page:
> http://home.comcast.net/~n1umj/wsb/html/view.cgi-home.html-.html
> myspace: http://www.myspace.com/n1umj 
> 
> __________
> View the list's information and change your settings at 
> http://www.freelists.org/list/programmingblind
> 
>
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind

Other related posts: