Safiron

Pointery a reference

Nov 17th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int x = 5; // promenná X s hodnotou 5
  8.     int* pointer = &x; // do pointeru ulozim adresu promenne X pres znak &
  9.  
  10.  
  11.     cout << "Hodnota promenne X: " << x << endl;
  12.     cout << "Hodnota pointeru: "  << pointer << endl;
  13.     cout << "Adresa promenne X: " << &x << endl;
  14.     cout << "Hodnota na adrese pointeru: " << *pointer << endl;
  15.     cin.get();
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment