Comments on Pointers in K&R
Microtherion said:
Rather more surprising, at first sight, is the fact that a reference toa[i]
can also be written as*(a+i)
.
I did not find that all that surprising, but the first time I saw
that a[i]
can also be written as i[a]
, I
was very irritated.
Diehunde said:
I don't know. I read the pointers chapter at least 3 times, and I still get confused when I see pointer stuff in real code. The other day, I read the famous regex post by Russ Cox, and it took me a couple of hours to understand the pointer parts of the code even though the algorithm behind it was relatively simple. I guess pointers are just one of those things that for some people make a lot of sense, whereas others struggle with.
Disown said:
K&R is easily one of the best CS/programming books. Short, concise and to the point.
Another way to learn pointers is via assembly. Either learn assembly or just look at the disassembled code. Look under the hood and it'll become clearer.
Of course the best way is to write your own C compiler but that may be overkill for most.