I want to new a StringArray as follow:
class Test
{
public:
QString* str[];
Test() {
str = new QString[];
}
};
is there some wrong: about str = new QString[] ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You didn’t specify a size for the array.
Note that there is special syntax for the
deleteoperator when deleting an array as well:If you want a dynamic array, consider using STL vector (
std::vector<QString>in this case) instead.