Hacker News new | past | comments | ask | show | jobs | submit login

Any additional recommendations for C tutorials?



CS50 [0], if you're just getting started. It's Harvard's entry course to Computer Science, free, and covers most of the knowledge a beginner needs to get started.

[0] https://www.edx.org/course/introduction-computer-science-har...


I'm not sure of any. I do a bunch of embedded C code. I find a lot of C code tutorials are algorithm / datastructure focused. Which is ok to learn. You should definitely feel confident in implementing data structures / algorithms in C. But I'm not sure of any good tutorials which teach you how to engineer C programs. There is no "one true approach" but you definitely need to take "a" approach to constructing C programs. You need to have really good convention about how to do various things and how to compose your software.

Also C unit testing is often rare. I ended up writing my own framework (which I open sourced, but am neglectful with maintenace) with the idea you can run tests on embedded devices. Meaning it only relies on pretty vanilla C and has no memory allocation.

But, definitely incorporate unit testing in your C coding experience. It will help focus you on not falling for the evils of the language


When i was about 13 or 14 years old, i read Brian Kerninghan & Dennis Ritchie's "The C Programming Language". This book (by the language creators) is a classic and does an excellent job of explaining the C language. I learnt C by reading that book and experimenting writing code.

It is a very good book and it should be easily available.


A lot of people love this book, but I kept getting stuck because it seems like half the time it assumes prior programming knowledge. I only made it a few chapters in, but I don't think they do a great job of explaining much of anything to a beginner.

I'm planning on attempting to read it again after I finish Harvard's CS50. Maybe I just need a lot of hand-holding, but this course seems to do a much better job of explaining concepts.


>but I kept getting stuck because it seems like half the time it assumes prior programming knowledge

Yes, to be honest, C is not good as a "first" programming language. If i can give you a suggestion, it would be: Start learning Python, which is a good "first language to learn", and then try this book.

You will find that jumping from Python to C there will be two strong differences:

a) C is a statically typed language, so you will need to declare (specify) the type of each variable you would like to use.

b) In Python, the language manages your usage of the computer's memory. In C, you manage the memory... After some CS courses you'll probably be familiar with concepts like "linked lists", which then you can try implementing in C by using pointers. Thus, you'll realize that in C you are in control of the computer's memory; you will be able to request (allocate, with malloc) blocks of memory and free them afterwards.

c) C syntax can be tricky, compared to Python.


I have had a great success teaching a kid programming using javascript and plain HTML. There are numerous advantages to this approach.


K&R was written for programmers, so it's completely unsurprising you would have trouble reading it while learning to program.

Working your way through it after taking CS50 is actually a fantastic idea.


I don't know C, but I know that (learnXinYminuts . com) have something similar for mane languages




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: