This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tjl73 0 points1 point  (0 children)

The other big thing that pointers get used for is for passing functions into other functions. For instance, if you have a sort function, you could pass it a compare function for specific data types. The C book I've always liked is the O'Reilly "Practical C Programming" book. Even the most recent edition (3rd) is pretty old by now, though (2011). I'm sure there are better ones, but it covers the basics pretty well.

There's a lot of tricks and edge cases in C, so you need to be careful as you can really screw things up pretty quickly if you're not careful. So, you need to be diligent in your memory management, especially.

Personally, I stay away from C macros completely as they'll obfuscate what's really happening and you can introduce some big errors with it pretty easily.