I'm sorry but I don't understand your reply.
I didn't know that I could not create a pointer to an integer like this.
Could you reexplain the above, I'm just now sure what you're telling me. Thanks
1 2 3 4 5 6 7 8 9 10 11
//Instead I've done it like this.
int p = 5;
int *x = &p;
//Or, another way I can write this is:
int p = 5;
int *x;
x = &p;
int* x is a pointer.
Pointers store memory addresses.
What does it mean to store "5" as a memory address?
If you want an integer variable, use int x = 5;.
If you want a pointer to a variable whose value is 5, use either
1 2
int someOtherInt = 5;
int* x = &someOtherInt;
or int* x = newint(5); (but if you do that last one, you have to delete x; after you're done).
If you want a pointer to the memory address 0x5 (not sure why -- that's not a spot you should be tampering with), try int* x = reinterpret_cast<int*>(5);.