View Full Version : arrays hard to grasp?

07-22-2004, 07:56 AM
I've noticed that back in my High School programming class, we learned arrays before functions, but in all the programming classes I'm taking now in college, we're learning arrays after pointers, functions, and even objects... this doesn't make sense IMO, and I was just wondering if anybody else had any other opinions/observations/answers...

07-22-2004, 08:01 AM
Personaly i didn't find them hard, and in my class we learned about them early on, teacher explained same time as he explained functions

07-22-2004, 09:35 AM
I found that in college too, in my beginning programming classes. And I never found the concept to be hard at all, but there were a lot of people that REALLY struggled with it. Granted, a lot of those people weren't going into a programming related field, it was just a requirement for them to take a programming class. But yeah, there are a lot harder things than arrays.

07-22-2004, 09:40 AM
I didn't find them hard at all, either. I also think it actually harmful to teach arrays after objects AND pointers. I can't learn something unless I know why I'm learning it, and there's really not a lot of use you have for pointers without arrays, etc... Also - if you're teaching data structures for the first time - start with something simple, like an array?

07-24-2004, 02:35 PM
I can fully understand someone teaching C++ and covering the use of functions and objects before arrays, stressing the use of the vector class. That's simply good style and it makes sense. Without a reasonable substitute though, I'm not too sure about it. Arrays (or a decent facsimile) are pretty handy even in the first days of programming. ;)

07-25-2004, 03:06 AM
when it comes to understanding arrays, functions and pointers. arrays were by far the easiest for me, then functions, then pointers and that is the order i was taught in.

07-25-2004, 07:22 AM
>arrays were by far the easiest for me, then functions, then pointers and that is the order i was taught in.
A collection of homogeneous objects is easier to follow for a beginner than a callable collection of instructions and certainly the concept of a pointer. Especially the concept of a pointer, everyone talks about their power and flexibility so much, beginners are tricked into thinking that they must be complicated and overlook the simple facts. ;)

07-25-2004, 05:13 PM
I did at first. But i now just see arrays as a collection of individual variables, which is what they are.

An int array of say [2] is like joining 3 variables together side by side. I'm not entirely sure of the benefits of arrays i think it must have an efficiency property to it.

07-26-2004, 09:41 AM
instead of doing this:
int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y, z;
float fa,fb,fc,fd,fe,ff,fg,fh,fi,fj,fk,fl,fm,fn,fo,fp,fq ,fr,fs,ft,fu,fv,fw,fx,fy,fz;
you can just do:

int i[25];
float f[25];
and the array version lends itself nicely to looping...