how many bits is allocated for an integer when allocating on heap

  c++, pointers

So I have been tinkering with C++ lately and I allocated memory for an integer like this:

int* p = new int;

As I thought, an integer is usually 4 / 3 bits depending on the system architecture,
but when printing the size of the memory that this pointer allocates:

cout << sizeof p << " is the size of an int" << endl;
// output: 8 is the size of an int

Why is that so?
Help would be much appreciated.

Source: Windows Questions C++

LEAVE A COMMENT