summaryrefslogtreecommitdiff
path: root/12_read_ptr2/test.c
diff options
context:
space:
mode:
Diffstat (limited to '12_read_ptr2/test.c')
-rw-r--r--12_read_ptr2/test.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/12_read_ptr2/test.c b/12_read_ptr2/test.c
new file mode 100644
index 0000000..ffa4754
--- /dev/null
+++ b/12_read_ptr2/test.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int f(int ** r, int ** s) {
+ int temp = ** r;
+ int temp2 = **s;
+ int * z = *r;
+ *r = *s;
+ *s = z;
+ printf("**r = %d\n",**r);
+ printf("**s = %d\n",**s);
+ *z += 3;
+ **s -= 8;
+ **r -= 19;
+ return temp + temp2;
+}
+
+int main(void) {
+ int a = 80;
+ int b = 12;
+ int * p = &a;
+ int * q = &b;
+ int x = f(&p, &q);
+ printf("x = %d\n", x);
+ printf("*p = %d\n", *p);
+ printf("*q = %d\n", *q);
+ printf("a = %d\n", a);
+ printf("b = %d\n", b);
+ return EXIT_SUCCESS;
+}