6 ms·
Whenever I was trying to learn C (and as ever making small bits of progress), what I always wanted was a great visualisation system for pointers. I've seen vari
by scandox 9y ago
Whenever I was trying to learn C (and as ever making small bits of progress), what I always wanted was a great visualisation system for pointers. I've seen various attempts at this online but I've never really found something that felt intuitive. I think a good on-paper means of reasoning about pointers would be a huge help in becoming fluent in C.
- groundCode 9y agoDavid malan’s CS50 course has some nice material on this. Some of the clearest well presented and enthusiastic lectures I’ve seen.
- mcjiggerlog 9y agoWhere can we watch them?
- sus_007 9y agohttp://cs50.harvard.edu/ http://cs50.harvard.edu/
- mcjiggerlog 9y agoAs far as I can tell, only the last lecture is available.
- philangist 9y agohttps://www.youtube.com/watch?v=EApk15pCIEA https://www.youtube.com/watch?v=EApk15pCIEA
- b3b0p 9y agoThere are multiple websites and communities. The /r/cs50 [0] is popular. Also, there is cs50.tv [1]. Tons of information and where or how to work through the course. Many options. [0] https://reddit.com/r/cs50 https://reddit.com/r/cs50 [1] https://cs50.tv https://cs50.tv
- ryl00 9y agoWhat about this analogy? You have a piece of paper with a street address on it (the pointer value). You go to that street address (derefence the pointer), open the mailbox, and inside is another piece of paper with what you're actually looking for (like someone's name). For pointers to pointers, add another level of indirection..
- vram22 9y agoAnd after you've learned that (basics of pointers in C), a nice quick test of your knowledge (but not a comprehensive one) can be to read this standard declaration of main() in C (based on ANSI C, BTW, as described in 2nd edition of K&R C book, not sure if changed in later versions of standard): int main(int ac, char **av) and then try to figure what the following mean (what type they are, and whether each of them is a pointer or a pointed-to thing, or both: av *av **av av[0] etc. I was once teaching a class on C to a group of experienced programmers (10+ years each, but new to C), and after I explained the char **av stuff, one of them said "Now it is overhead transmission" :)
- Vindicis 9y agoI don't think really anyone has difficulty understanding the concept of a pointer. It's their usage that trips people up, and that most tutorials I've seen gloss over, which is where all the confusion stems from.
- ovao 9y agoExactly. There is the concept and the syntax of pointers, and those are relatively straightforward to understand. I gave up on learning C++ — twice — when I was a kid because no book explained why there are pointers. It’s all very “a pointer points to something! Now on to the next chapter.” (The third time was the charm, luckily.) One simple example showing value semantics would’ve made it click for me, and things only get more interesting when you talk about performance.
- nebgnahz 9y agoI have used C Tutor when I was teaching C to undergrad. Here is a visualization I created to illustrate linked list: https://goo.gl/12juwA https://goo.gl/12juwA
- scandox 9y agoHey! I actually did see this before because I was searching for exactly that. I think I found it helpful in a specific way - maybe I should try using it for longer to see if it sticks in my mind. I think that's what I'm really lacking - a kind of mental visual short hand that holds together in my head.
- Gibbon1 9y ago> what I always wanted was a great visualization system for pointers Look at 68000 assembly language. In particular indexed addressing modes. In C really that's almost all they are.
- erobbins 9y agoI had the same problem.. I kind of flopped and floundered around for a week or 2 before it just suddenly clicked one day and I was off to the races. Pointers are still my favorite part of C, but I struggle to explain them to new programmers.
- ipython 8y agoOld school now, but back in the late 90s I used GNU ddd. See some example screenshots here: https://www.gnu.org/software/ddd/manual/html_mono/ddd.html#Shared%20Structures https://www.gnu.org/software/ddd/manual/html_mono/ddd.html#S...