Why can’t I do this:
struct sName {
vector<int> x;
};
It takes only three pointers to store a vector, so I should be able to do this?
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 mentioned this failed in a switch statement. You’ll need to wrap it up in an extra pair of braces:
Alternatively, you could have already declared the structure, and are just trying to declare and initialize a local variable. This isn’t a problem unique to
struct, it’ll happen anytime you try to initialize a variable inside a case: