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

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top