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 ];

        cout << "array one length  = " <<  sizeof( array_one ) /
sizeof(int) << endl;
        cout << "array two length  = " << sizeof( array_two ) /
sizeof(int)  << endl;

        delete [] array_two;
        return 0;
}



--- Paul Herring <[EMAIL PROTECTED]> wrote:

> On 2/2/07, Joseph A. Marrero <[EMAIL PROTECTED]>
> wrote:
> > Hi Robert. In C++, there is no way to know the length
> of an
> > arbitrary array.
> 
> sizeof?
> 
> -- 
> 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/


 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

Reply via email to