This commit is contained in:
2026-03-10 16:27:53 +01:00
parent be6ca147f2
commit fd9be86bde
11 changed files with 132 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
#include <iostream>
using namespace std;
void podwoj1(int x) { x *= 2; }
void podwoj2(int &x) { x *= 2; }
int main() {
int a = 5;
cout << a << endl;
podwoj1(a); // nie zmieni wartości poza funkcją
cout << "a po podwojeniu kopią: " << a << endl;
podwoj2(a); // zmieni wartość poza funkcją
cout << "a po podwojeniu referencją: " << a << endl;
}