diff options
author | Haidong Ji | 2022-04-15 15:51:30 -0500 |
---|---|---|
committer | Haidong Ji | 2022-04-15 15:51:30 -0500 |
commit | 442a49ad5a48d417345959b903ae6a6d32d55759 (patch) | |
tree | c7127bb497e5e439018b1915e0136eec2c9cb124 /13_read_arr1/test.c |
Excellent fundamentals and displine training, many tools and techniques
exercises: gdb, emacs, valgrind, git
Diffstat (limited to '13_read_arr1/test.c')
-rw-r--r-- | 13_read_arr1/test.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/13_read_arr1/test.c b/13_read_arr1/test.c new file mode 100644 index 0000000..824b502 --- /dev/null +++ b/13_read_arr1/test.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#include <stdlib.h> + + +int main(void) { + int anArray[] = {5,16,33,99}; + int * p = anArray; + printf("*p = %d\n", *p); + p++; + printf("Now *p = %d\n", *p); + int * q = &anArray[3]; + int ** x = &q; + **x = 12; + *x = p; + **x = 42; + q[1] = 9; + for (int i =0; i < 4; i++){ + printf("anArray[%d] = %d\n",i, anArray[i]); + } + return EXIT_SUCCESS; +} |