summaryrefslogtreecommitdiff
path: root/testing/pointertest.c
diff options
context:
space:
mode:
authorTomek CEDRO <cederom@tlen.pl>2011-11-03 03:26:18 +0100
committerTomek CEDRO <cederom@tlen.pl>2011-11-03 03:26:18 +0100
commitc06e0b49f4fde00e71f5c2be57bbcfbfe09079e0 (patch)
tree441da319df480fd9d4d098e54d56d22d735d3fba /testing/pointertest.c
parent02498e0ed4e142a966c2bda5bfb1e8153e7a85c8 (diff)
parentad9f081b6152a9c36bfb4bf74299f6ad959088c9 (diff)
downloadopenocd+libswd-c06e0b49f4fde00e71f5c2be57bbcfbfe09079e0.tar.gz
openocd+libswd-c06e0b49f4fde00e71f5c2be57bbcfbfe09079e0.tar.bz2
openocd+libswd-c06e0b49f4fde00e71f5c2be57bbcfbfe09079e0.tar.xz
openocd+libswd-c06e0b49f4fde00e71f5c2be57bbcfbfe09079e0.zip
Merge branch 'master' of ssh://repo.or.cz/srv/git/openocd/libswd
Diffstat (limited to 'testing/pointertest.c')
-rw-r--r--testing/pointertest.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/testing/pointertest.c b/testing/pointertest.c
new file mode 100644
index 00000000..0b5432e8
--- /dev/null
+++ b/testing/pointertest.c
@@ -0,0 +1,24 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+int f2(int *pf21, int *pf22){
+ int *stuff;
+ stuff=(int*)calloc(1,sizeof(int));
+ if (!stuff) exit(-1);
+ *stuff=0xDEADBEEF;
+ printf("stuff[@%X]=%X\n", stuff, *stuff);
+ *pf21=stuff;
+ *pf22=*stuff;
+ return 0;
+}
+
+int f1(int *pf11, int *pf12){
+ return f2(pf11, pf12);
+}
+
+int main(){
+ int a1=0,a2=0;
+ f1(&a1,&a2);
+ printf("a1[@%X]=%X\na2[@%X]=%X\n", &a1, a1, &a2, a2);
+ return 0;
+}