Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
1 files changed, 22 insertions, 0 deletions
-rw-r--r--Sem. 12/references.cpp22
diff --git a/Sem. 12/references.cpp b/Sem. 12/references.cpp
new file mode 100644
index 0000000..5922d33
--- /dev/null
+++ b/Sem. 12/references.cpp
@@ -0,0 +1,22 @@
+#include <iostream>
+using namespace std;
+
+void f(int a)
+{
+ a += 5;
+
+}
+void f2(int& a)
+{
+ a += 5;
+}
+
+int main()
+{
+ int x = 10;
+ f(x);
+ cout << x << endl; //10
+
+ f2(x);
+ cout << x << endl; //15
+}