Computer Science Canada

size of an array

Author:  The_$hit [ Tue Jun 21, 2005 6:40 pm ]
Post subject:  size of an array

does any one know the function to find the size of an array?

Author:  wtd [ Tue Jun 21, 2005 7:05 pm ]
Post subject:  Re: size of an array

The_$hit wrote:
does any one know the function to find the size of an array?


Use std::vector instead of an array.

Author:  1of42 [ Tue Jun 21, 2005 7:28 pm ]
Post subject: 

To be more clear, there is no function to find the size of an array, since an array is just a glorified pointer. You have to manually keep track of the size of the array yourself.

Oh - use a vector Wink

Author:  Cinjection [ Tue Jun 21, 2005 7:53 pm ]
Post subject:  Re: size of an array

wtd wrote:

Use std::vector instead of an array.


Dude, you want to tell me why in all your C++ posts you use std:: ? Just put

code:
using namespace std;

Author:  Andy [ Tue Jun 21, 2005 8:15 pm ]
Post subject: 

because its more standard.. if we simply told them to use vector, then they'll come back saying it doesnt work and blah blah.. but if u use std::vector, then it'll work no matter what, plus it keeps the file size down

Author:  wtd [ Tue Jun 21, 2005 8:22 pm ]
Post subject:  Re: size of an array

Cinjection wrote:
wtd wrote:

Use std::vector instead of an array.


Dude, you want to tell me why in all your C++ posts you use std:: ? Just put

code:
using namespace std;


Lots of stuff lives in the std namespace. I don't want all of it my namespace.

Author:  The_$hit [ Tue Jun 21, 2005 8:25 pm ]
Post subject: 

i need to use pointers tho.... and i need to se how many values are passed through the parameters. Is there any way of doing this with pointers or arrays?

Author:  wtd [ Tue Jun 21, 2005 8:54 pm ]
Post subject: 

How about showing us what you do have, or even describing what you're actually trying to accomplish.


: