I'm a little confused about the implementation of linked.c, specifically in the function insert_node(). The first thing we want to do there is to create a new node. They proceed to create a pointer to a node (node*). Why can't we just create a new actual node, as by
node new_node
instead of a pointer to a node? Is it just because we don't necessarily want it to disappear when the function returns? If that's the answer, I guess it also answers my next question, which was why don't we have to malloc anything for curr and prev. I guess we'd be content for those variables and anything in them to go away when the function returns.
Am I on the write track with the differences in how those three pointers were declared?
Another follow up question. Is that pretty much always the answer when you're working with some values in a function that you want to be able to use in main()? Instead of declaring a local variable, create a pointer and malloc some space instead?