Pass by Value: In pass by value, when you pass a variable into a function, the function will use a copy of the variable, so the original is not affected.
2
1
2
1
2
1
Pass by Reference: In pass by reference, you pass the reference of the variable, so since both int x and int x inside the function reference the same thing, if you change one, the other one changes too.
2
2
3
3
4
4