Greetings,

I am having difficulties understanding this problem, my concept of capacity and size properties of a vector are crystal clear but...

Can anyone solve this problem and explain why you got the answers you did? Below I have added my answers into the questions can anyone explain why I got these wrong or right?

See below:

vector<int> x,y(7),z(4,2),w(6);

w.push_back(14);

w.push_back(39);

1. capacity of x is 0 and size is 0

2. capacity of y is 7 and size is 0

3. " " z is 4 and size is 2

4. " " w is 6 and size is 0

what is the output of:

5. cout <<w.front() << ' ' << w.back()<<endl;

ans. 0, 39