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