size of dynamic array?

Joined
Oct 6, 2008
Messages
1
Reaction score
0
I have an array of pointers to some obj; This array is created from inside a function.

typedef struct{
char* name;
int size;
}Car;

Char** getCarsArray()
{
int randNum = rand(); // assume randNum is a valid random number
Car** cars_ptr = new Car*[randNum];
for(int i=0; i< randNum; i++)
cars = new Car;
return cars_ptr;
}
***************************
// main

Car** cars_ptr = getCarsArray();

Assuming cars_ptr points to an array of pointers of Cars, how can you get the array size of this array??

Any help would be great.
thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,792
Messages
2,569,639
Members
45,348
Latest member
RoscoeNevi

Latest Threads

Top