#include <iostream> using namespace std; void tryToChange(int x) { x = 100; // Only changes the local copy } int main() { int num = 5; tryToChange(num); cout << num << "\n"; // Still 5 return 0; } // Outputs: 5
Click Run to execute this code.