diff options
author | smlckz <smlckz@college> | 2021-12-22 14:56:13 +0530 |
---|---|---|
committer | smlckz <smlckz@college> | 2021-12-22 14:56:13 +0530 |
commit | b73983c3717642ca10e7cfe93d97609adc377da9 (patch) | |
tree | a6e9fe4c27e3caa215f8aefa9265fb52f6de4375 /assignments/24-value-vs-ref.c | |
download | college-b73983c3717642ca10e7cfe93d97609adc377da9.tar.gz |
backup
Diffstat (limited to 'assignments/24-value-vs-ref.c')
-rw-r--r-- | assignments/24-value-vs-ref.c | 21 |
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; +} + |