Learn C Programming Language: Tips & Resources

Click For Summary
Learning C independently is a valuable endeavor, especially for those preparing for a microcontrollers class. The book "The C Programming Language" by Brian Kernighan and Dennis Ritchie is highly recommended for its concise style and effective exercises, making it suitable even for beginners with some programming background, such as those who have taken a C++ class. While the book is comprehensive, it's crucial to avoid skipping sections to prevent misunderstandings, particularly regarding C's unique aspects like undefined behavior. Writing simple programs while following the book can reinforce learning. Some participants suggest supplementing K&R with other resources like Deitel's "C How to Program" for more detailed explanations and additional exercises, which can help build good programming habits. Overall, K&R is considered a solid foundational text that remains useful even as one becomes more experienced.
sanhuy
Messages
40
Reaction score
2
Hi all, I am looking to learn C by myself since it is a programming language that is used in my micro controllers class that i am going to take during the upcoming Spring semester at my university. I was wondering how i should go about doing this? I was thinking of using book The C Programming Langauge by Brian Kernighan and Dennis Ritchie. Would this be a good idea for a person that has only taken 1 cs class that was taught in C++ (intro cs class covered stuff like datatypes, variables, functions, arrays, flow of control, and loop.) Do you have any other suggestions of materials, such as online lecture courses, different textbooks or youtube videos, that i should use instead?

kind regards,
sanhuy
 
  • Like
Likes Dr. Courtney
Technology news on Phys.org
That's the book I used to learn C. Worked well for me, but I was an experienced programmer when I started it.
 
I think i may just use this book. I was skimming through the tutorial chapter, and it was written nice and concisely, with a few examples and exercises, just like textbooks should be written. It doesn't to give you 20 page introductions, which many textbooks do.

do you think the text and the exercises are good enough to learn the language or is there anything else that i should be doing?
 
I think you should go through that book, THEN worry about what to do next. It really has all you need. It IS concise so you need to be careful that you don't go too fast or skip stuff.

I would also start WRITING simple (VERY simple) programs and add to them as you learn new things. I created a program called C PLAY that basically, by the time I was done, contained a usage of every construct in the book.
 
  • Like
Likes jedishrfu and jim mcnamara
I agree with phinds that the K & R book is a good choice, especially since you have already had a class that was presented in C++. If you were coming into C as a complete novice, I might not suggest the K & R book.
 
  • Like
Likes jedishrfu
Phinds said 'do not skip stuff'. He was very right. C has this nasty thing- it will let you write code that will do odd things, like crash unexpectedly. This nastiness is called 'undefined behavior'. It is hard to create in most upper level programming languages, awfully easy to do in C. Follow the book scrupulously. Code the way you learned from the book and life will be good.
 
  • Like
Likes jedishrfu
I concur k&r is an excellent book to learn from. Its easy to read and very concise.
 
Kernighan and Ritchie is the book by the people who originally defined C, so it is a good book. As a beginner, you may want more explanation in some places, but the internet can fill in where needed. In general, I think it is a good book for a beginner and will still be your main reference when you are an expert.
 
What I also like is that the exercises are useful. You'll have to try and think about how certain functions you'll use very often actually work.
I haven't done most of them but when I read them I liked them more than the assignments we were given for the class that used the book.
 
  • #10
K&R is definitely a good book but if you want some things explained, I'd suggest Deitel's book "C How to Program". I studied through this book and some others as well when I was learning C and I found that it is particularly good at explanations of concepts, has many exercises and projects - particularly now with the LiveCode approach, helps to develop good programming habits in general and - with no intention by my side to advertise it, it is definitely an excellent book.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
Replies
86
Views
1K
  • · Replies 25 ·
Replies
25
Views
700
  • · Replies 15 ·
Replies
15
Views
3K
Replies
69
Views
10K
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
Replies
16
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 397 ·
14
Replies
397
Views
20K