int array_one[ 25 ];
> > int *array_two = new int[ 25 ];
if you wanted to total up the ints, how would you do it.
for(int i=0; i<array_one; i++) {
total += array_one [i];
and then cout << "The total Is: " <<; }
"Joseph A. Marrero" <[EMAIL PROTECTED]> wrote:
This is one of the strage parts of C/C++. I thought
array_name[idx] notation was syntactic sugar for the
*(array_name + idx). The question is how different are they
with respect to their layout in memory? Some would argue
that they are not different at all except for whether they
are on the stack or the heap. Maybe this is something I
don't understand at all, but I believe both are arrays.
--- Paul Herring <[EMAIL PROTECTED]> wrote:
> On 2/3/07, Joseph A. Marrero <[EMAIL PROTECTED]>
> wrote:
> > I think sizeof will only work on statically allocated
> > arrays. Consider the following:
> >
> >
> > #include <iostream>
> > using namespace std;
> >
> > int main()
> > {
> > int array_one[ 25 ];
> > int *array_two = new int[ 25 ];
>
> array_two isn't an array, it's a pointer to an int. The
> int it happens
> to point to is the first item in an array.
>
>
> --
> PJH
>
> #706281 +(1868)- [X]
> TriPod11: bush ain't THAT bad...he kinda knows what he's
> doin
> idaredbeet08: Please, Monica Lewenski had more President
> in her than
> George Bush ever will.
>
_________________
Joseph A. Marrero
http://www.l33tprogrammer.com/
__________________________________________________________
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/
---------------------------------
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.