trytryhard

adr

Dec 12th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int abc = 5, *intptr;
  7. char chval = 'f', *chvalptr;
  8. bool blval = true, *blvalptr;
  9. float flval = 3.53, *flvalptr;
  10.  
  11. intptr = &abc;
  12. chvalptr = &chval;
  13. blvalptr = &blval;
  14. flvalptr = &flval;
  15.  
  16. cout << "Size of the int pointer = " << sizeof(intptr) << " Address = " << intptr << " Value = " << *intptr<<endl;
  17. cout << "Size of the char pointer = " << sizeof(chvalptr) << " Address = " << chvalptr << " Value = " << *chvalptr << endl;
  18. cout << "Size of the boolean pointer = " << sizeof(blvalptr) << " Address = " << blvalptr << " Value = " << *blvalptr << endl;
  19. cout << "Size of the float pointer = " << sizeof(flvalptr) << " Address = " << flvalptr << " Value = " << *flvalptr << endl;
  20. system("pause");
  21. }
Advertisement
Add Comment
Please, Sign In to add comment