> Then I simply would like to type in the address, and access what is inside of it.
> I was just wondering if this was at all possible and if so how?
Use a variable of type std::uintptr_t to hold the value of the pointer.
And then perform a reinterpret_cast<>.
(This won't prevent the bad things that could happen if you type in a wrong value for the address.)
> on line 13, I'm kinda being forced to store in address, rather then having the user input the value.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
int i = 1234567 ;
constint* p = &i ;
std::cout << "address: " << reinterpret_cast<std::uintptr_t>(p) ;
std::uintptr_t n ;
std::cin >> n ;
constint* q = reinterpret_cast<constint*>(n) ;
std::cout << "the int at address " << p << " is " << *p << '\n'
<< "the int at address " << q << " is " << *q << '\n' ;
This is a bad program; it will cause undefined behaviour if the user enters a wrong value.