Ok I read the chapter again on pointers and still can't seem to grab hold of it. I understand the what pointer are and what they do in theory just can't seem to do it in real life. Here is another pointer problem we I have to show what the output would be base of the assumed values. If possible use my code to explain pointers to me I think I will understand better.
Code:
int list[] = {3, 9, 6}; /* assume list is at address 10240 */
int n = 150; /* assume n is at address 10252 *
int *p = list /* assume n1 is at address 10256 */
printf("%d -- %d\n", &list[0], list[0]);
printf("%d -- %d\n", &list[1], list[1]);
printf("%d -- %d\n", &list[2], list[2]);
printf("%d -- %d\n", &n, n);
printf("%d -- %d -- %d\n", &p, p, *p);
p++;
printf("%d -- %d -- %d\n", &p, p, *p);
p = list;
printf("%d -- %d\n", (p + 1), *(p + 1));
printf("%d -- %d\n", (p + 2), *(p + 2));
printf("%d -- %d\n", p + 1, *p + 1);
----- My Output ---------
10540 -- 3
10541 -- 9
10542 -- 6
10252 -- 150
10256 -- 10240 -- 3
10256 -- 10244 -- 9
10257 -- 4
10258 -- 5
10257 -- 4
-----------------------------
I'm not real confident my output is right. using this example could someone explain it to me.
thanks.