Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

4 byte pointer, 36 bits ram

$
0
0
I was playing around with pointers and decided to see how big a pointer was. It seemed the pointer was 4 bytes in size, 32 bits. However, I have 8GB Ram, which comes to 2^36 bits. So wouldn't the pointer need at least be 36 bits to address all possible addresses?

#include <iostream>

using std::cout;
using std::endl;

int main()
{
	long long  myVar = 0;
	long long* myPointer = &myVar;

	cout << sizeof(myVar) << endl;     // 8
	cout << sizeof(myPointer) << endl; // 4

	cout << endl << endl;
	system("pause");
	return 0;
}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>