summary refs log tree commit diff stats
path: root/assignments/24-value-vs-ref.c
diff options
context:
space:
mode:
Diffstat (limited to 'assignments/24-value-vs-ref.c')
-rw-r--r--assignments/24-value-vs-ref.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/assignments/24-value-vs-ref.c b/assignments/24-value-vs-ref.c
new file mode 100644
index 0000000..8640792
--- /dev/null
+++ b/assignments/24-value-vs-ref.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+void swap_by_value(int a, int b)
+{
+	int c = a;
+	b = a;
+	b = c;
+}
+
+void swap_by_ref(int *a, int *b)
+{
+	int c = *a;
+	*a = *b;
+	*b = c;
+}
+
+int main(void)
+{
+	return 0;
+}
+