diff options
Diffstat (limited to 'testing/pointertest.c')
-rw-r--r-- | testing/pointertest.c | 24 |
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; +} |