Re: C programming Arrays

  • From: "John Miller" <n1umj@xxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 9 Oct 2007 20:47:43 -0400

I understand the concept of what an array does, I'm just not sure how to use it. Example, I can get started with them, declaring the variables and all with the number in brackets, but after that, no matter how many sites I look at, it's like I'm looking at the same things over again and I'm not getting it, especially when it comes to adding it in to an already existing program assignment. If that makes sense, I need something closer to my assignment figuring out employee wages and all and just an empty example, or an example when the numbers in the program are already known, instead of like with this program when I have to enter them, that's where I get stuck. I can get the idea if I see something closer to actual work. My main problem is, I went in to this class knowing nothing. I'm getting there, but I'm not a programmer. I see all the time where that's obvious in what I miss. I'm trying pretty much to get through the class. At this point and am with a lot of help. I'm trying to depend less on help and more on getting things done but getting enough help to at least pass. If I didn't need the class I'd get rid of it, actually, if it wasn't for the fact I had to drop a class already that I couldn't take because the program needed for everything didn't work with a screen reader, I'd drop it and try again on campus where I might be able to work more with people in the class but I'm kind of locked in to right now where I have to take and pass it. ----- Original Message ----- From: "Dale Leavens" <dleavens@xxxxxxx>

To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, October 09, 2007 7:02 PM
Subject: 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
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: