| 12345678910111213141516171819202122232425 |
- #include "try_pointer.hpp"
- using namespace std;
- int main()
- {
- int n = 5;
- cout << &n << endl;
- int *ptr = &n;
- cout << ptr << endl;
- cout << *ptr << endl;
- *ptr = 10;
- cout << ptr << endl;
- cout << *ptr << endl;
- // the value of n also changed
- cout << n << endl;
- char letter = 'a';
- char *l_ptr = &letter;
- print(l_ptr, 'c');
- print(ptr, 'i');
- return 0;
- }
|