From ad9f081b6152a9c36bfb4bf74299f6ad959088c9 Mon Sep 17 00:00:00 2001 From: Tomek CEDRO Date: Thu, 3 Nov 2011 02:18:57 +0000 Subject: Added simple pointer test program to testing/pointertest.c. --- testing/pointertest.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 testing/pointertest.c (limited to 'testing') 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 +#include + +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; +} -- cgit v1.2.3