Question from the C++ test

Write a C++ program that creates an array of 10 Person objects.

Medium

Consider the following code fragment:

class Person{
public:
//default constructor
//…
 
//destructor
~Person(){
}
};
int main(int argc, char **argv)
{
..
Person *ps = new Person[10];
..
if(NULL != ps)
delete[] ps;
 
return 0;
}
 

What does declaring variable ‘ps’ in main() do?

Author: Abha AgrawaStatus: PublishedQuestion passed 404 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!