# Vector Methods

## Vector Methods <a href="#vector-methods" id="vector-methods"></a>

Vectors have a handful of useful functions, which you can see [here](http://www.cplusplus.com/reference/vector/vector/). In this part of the lesson, you will go over the ones you will be using in the object oriented programming lesson.

### assign <a href="#assign" id="assign"></a>

Assign helps you quickly populate a vector with fixed values. For example this code,

```
vector<int> intvariable;
intvariable.assign(10,16);
```

is going to populate the vector with ten integers all having the value of 16.

The assign method lets you override your current vector with a new vector.

Remember, you've already seen a similar way to initialize values in a vector:

```
vector<int> intvariable(10,16);
```

The difference is that the assign method lets you override your current vector with new values.

### push\_back <a href="#push_back" id="push_back"></a>

Pushback adds an element to the end of the vector:

```
vector<int> intvariable;
intvariable.push_back(25);
```

### size <a href="#size" id="size"></a>

Size returns the size of the vector.

```
intvariable.size();
```
