Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int funkcja(int& a) // pobranie argumentu poprzez referencję (funkcja będzie pracować na podanej zmiennej)
- {
- cout << a << endl; // 2. 10
- ++a;
- cout << a << endl; // 3. 11
- return a;
- }
- int main()
- {
- int liczba = 10;
- cout << liczba << endl; // 1. 10
- cout << funkcja(liczba) << endl; // 4. 11
- cout << liczba << endl; // 5. 11
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement