Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int x = -99;
- cout << "Size of x: " << sizeof(x) << endl;
- cout << "Address of x: " << &(x) << endl;
- cout << "Size of Address of x: " << sizeof(&x) << endl;
- cout << "Value pointed to by Address of x: " << *(&(x)) << endl;
- cout << "Size of value pointed to by Address of x: " << sizeof(*&x) << endl;
- cout << endl;
- cout << "Pointer Variables" << endl;
- int* xptr = &x;
- cout << "Size of xptr: " << sizeof(xptr) << endl;
- cout << "Value pointed to by xptr: " << *xptr << endl;
- cout << "Address of xptr: " << &(xptr) << endl;
- cout << "Size of Address of xptr: " << sizeof(&xptr) << endl;
- cout << "Value pointed to by Address of xptr: " << *(&(xptr)) << endl;
- cout << "Size of value pointed to by Address of xptr: " << sizeof(*&xptr) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment