I have to acess a vector, which is a member of a structure...

Could you please help me..

Recommended Answers

All 3 Replies

Well its really simple

struct student
std::string name;
double midterm, final;
std::vector<double> assignments;

int main()
struct student a_student;
return 0;

Hi gerard,

Thanks for the info.. But , i need to retrieve the information that has pushed. Could you please help me..

Ok, if you want to retrieve the info at the last use "back"


If you want to retrieve from anywhere else using an index, use "at"


See this link for more info

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.