Question: As is the case with many students trying to learn c++ I'm a little confused about pointers and in particular pointers to objects.

A simple pointer such as 

```
int *x = new int(5);

```

is easy to understand because x simply stores the address of a word that stores the int 5.

But what if we have something like 

```
 MyClass *x = new MyClass();

```

In this case x can't point to a word containing an instance of MyClass since it could be larger than a word. 

So the question is what does an object pointer actually point to in memory?

Answer: 
```
MyClass *x = new MyClass();

```

In this case, x will store the address of a memory block that is `sizeof(MyClass)` in length.

Another use:

```
Myclass *y = new (0x11111122) MyClass();

```

In this case, y will store 0x11111122, which is an address where a new MyClass instance has been initialized (This example will most probably crash your application, as you are probably corrupting whatever is in memory at this address).
If you will change one word in this phrase

> 
> x simply stores the address of a word that stores the int 5
> 
> 
> 

then I hope it will be clear

> 
> x simply stores the address of a **memory** that stores the int 5 or MyClass(); 
> 
> 
> 

Operator new uses the value of `sizeof( int )` or `sizeof( MyClass )` to allocate enough memory. For example sizeof( long long ) is usually greater than sizeof of the mashine word.

Moreover even for integer numbers those size is for example is equal to 4 bytes the compiler can allocate actually 16 bytes instead of 4 bytes. It is implementation defined how much memory will be allocated. Take into account that you may overload the new function that allocates memory.

Take into account the following quote from the C++ Standard

> 
> 6 Unless an object is a bit-field or a base class subobject of zero
>  size, the address of that object is the address of the first byte it
>  occupies.
> 
> 
>