Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- /*
- Use pointers to the heap as opposed to a stack.
- Change the value of x and y around
- */
- using namespace std;
- int main (int argc, char *argv[])
- {
- int x = 10;
- int y = 459;
- int * pX = &x;
- int * pY = &y;
- int TEMP = *pX;
- *pX = *pY;
- *pY = TEMP;
- cout << "\n\t Value of x" << *pX;
- cout << "\n\t Value of y" << *pY;
- //cout << "\n\n\tValue of px without DEREFERENCE: " << pX;
- //cout << "\n\n\tValue of px with DEREFERENCE: " << *pX;
- cout << "\n\n\t";
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement