Question: I am trying to get size of an array in C++ to be used for stuff later on. Why does this yield 16? 

```
#include <iostream>

using namespace std;

int main()
{
    int a[4];
    cout << sizeof(a) << endl;

    return 0;
}

```

Should it not give 20? Because there are basically 20 bytes in this array from a[0] through a[4]? Size of an element can be verified by getting -

```
sizeof(a[0])

```

Now this is 4. 16/4 = 4, which means there are 4 blocks of 4 bytes, when there actually should be 5. Why is that?

P.S. My main confusion stemmed from getting sizeof(a[4]) - which is 4. Since it was giving an output 4 - I thought it was part of the array.

Answer: 
When doing `int a[4];` you are declaring an array of `4` integers. Therefore the size of the whole vector is 4 times the size of one `int` (and if the `int` happens to be 4 bytes, then the product is 16 bytes).

C/C++ (and many other languages) use a zero-based indexing. Which means that the elements of the array defined above are numbered from `0` to `3`.
```
int a[4];

```

has four elements: `a[0]`,`a[1]`,`a[2]` and `a[3]`.