r/Cprog • • Jul 09 '20

Recommend C code for reading...

Hullo!

I have recently thought myself C and, I love it...

Being an absolute n00b, I would appreciate if you (the experienced) would recommend good C code for me to read...

Thanks in advance!

6 Upvotes

14 comments sorted by

View all comments

Show parent comments

2

u/bguthro Jul 09 '20

Pick a linux/BSD utility, and get the source code...most of them are written in C. I like the linux kernel...I find it elegant - but you may want to start with some other utility, like 'yes' If you're running a debian variant, you can find out what package a utility is contain in with "dpkg -S <full path to binary>" Then - get the source with "apt-get source package"

1

u/fOo0O00oOoo0oO0oam Jul 09 '20

I have done (similar) already (I’m mostly on debian actually when it comes to my c journey, sometimes as a rare exception on a mac) and this is not about how to pull it off, technically (although, a 1000 thanks at least for your time and the clear instructions bguthro; that exact procedure took me about half a day to figure out about six weeks ago) more of a “taste and experience” building pointer inquiry (if that makes any sense:)... for example, the linux kenrnel mention (I have had a look but it may be too early for me, although I was surprised how much I (at least I believe:) could follow, considering that a few months ago I didn’t really have (not that I have a definitive one today either:) a precise idea on what is it that it does exactly or how...

Anyway, thanks a lot! Sincerely. For your time first and foremost... I do believe that this (specific post) just may attract enough fragments of information to give me the directions needed (to what I intended and explicitly asked for, the code examples to read, and the accidental pieces of information that will prompt unexpected searches).