Advertisement
MeehoweCK

Untitled

Jul 31st, 2018
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int funkcja(int a)
  6. {
  7.     cout << a << endl;              // 2. wypisze: 15
  8.     ++a;                            // inkrementacja - zwiększenie wartości zmiennej o 1
  9.     cout << a << endl;              // 3. wypisze: 16
  10.     return a;
  11. }
  12.  
  13. int main()
  14. {
  15.     int a = 15;
  16.     cout << a << endl;              // 1. wypisze: 15
  17.     cout << funkcja(a) << endl;     // 4. wypisze: 16 (wartość zwrócona przez funkcję)
  18.     cout << a << endl;              // 5. wypisze: 15 (oryginalna wartość zmiennej a NIE ZOSTAJE ZMIENIONA!!!)
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement