5 ms·
I bought this book on Yegge's recommendation as well, and this actually was a stumbling block for me at first. "Whyyy is this variable, ★★p a pointer to a poin
by losvedir 15y ago
I bought this book on Yegge's recommendation as well, and this actually was a stumbling block for me at first.
"Whyyy is this variable, ★★p a pointer to a pointer?! p is never referenced in the function, so why are we two levels of indirection down?!" I didn't realize at the time that pointers are copied by value in C, so in order to modify the pointer you need to give the function a pointer to it.
I guess it was worthwhile, though, because it encouraged me to play around with C[1] a bit in order to grok it.
P.S. Sorry for those stupid stars, HN kept eating my highlights. Any way to avoid that?
[1]https://gist.github.com/661564 https://gist.github.com/661564
- michaelcampbell 15y agoIndent your "code" with a few spaces. int **p; /* I used 4 spaces in front of "int" */
- losvedir 15y agoAh, thanks. I was hoping there was an inline way, but I guess this will have to do.
- deleted 15y ago[deleted]
- deleted 15y ago[deleted]
- deleted 15y ago[deleted]