I want to compare the memory address and pointer value of p, p + 1, q , and q + 1.
I want to understant what the following values actually mean. I can't quite wrap my head around whats going on.
When I run the code
I Get An Answer Of 00EFF680 for everytime I compare the adresss p with another pointer.
I Get An Answer of 00EFF670 for everytime I compare the address of q with another pointer
I Get An Answer of 15726208 when I look at the pointer value of p and I Get An Answer of 15726212 When I look at the pointer value of p + 1.
I Get An Answer of 15726192 when I look at the pointer value of q and I get An Answer of 15726200 Wehn I look at the pointer value of q + 1.
When you use == I do not think you are doing anything to the pointer.
Because == is just a comparison operator that returns true or false.
And then you are just printing one of the the pointers addresses with cout.
I think you need to use an assignment operator = instead.
If you want to print the memory address what is the purpose of the calculation? Why not just print the address? cout << p; Remember p is a pointer that is pointing to val, so printing p will print the address to print the value you need to de-reference the pointer:
cout << "The address of val is " << p << " and the value held in that address is: " << *p << endl;