Books on learning C?

Thanks for recommendation.I like how it teaches Unix programming and C together.
Highly recommend this:


Currently using this to write drivers for Thunderbolt HBAs to use FreeBSD as a ZFS based DAS.

I like that it walks you through the basics of setting up an environment to get started also. I think you’ll like it.
 
and what exactly is not clear? I think you need to read the book about algorithms Grokking Algorithms, Second Edition
An illustrated guide for programmers and other curious people
Автор: Адитья І Бхаргава. Наприклад, хочу сказати, що я також не одразу зрозумів, для чого потрібні масиви, чим динамічна пам'ять відрізняється від статичної ... Не соромтеся питати
don't teach the syntax of a programming language, the algorithm is our everything,
Code:
while (1 ) {
printf (" infinite loop \n ");
}
if you don't understand that instead of 1 you can write true or false. Programmers are not born, they are made
I am fine with the C syntax and basic programming concepts,but still I found some of the implementations in KnR to be hard understand.For example,in the chapter on functions,there was an example of a simple calculator using reverse Polish notation.I read that code along the explanation multiple times,but still couldn't understand how it works.
 
Is your goal explicitly to learn C and incidentally write utilities or is your goal to write utilities. You can write utilities in many languages, including Python.

If you want to learn C, you should read K&R. C is not intuitive. K&R is terse, yes, but it is correct and explains the correct way to think about the language constructs. There are many books that attempt to teach C, but end up teaching their particular, sometimes, incorrect understanding of C. C is subtle and K&R's phrasing is intentional. Other books may be easier to read, but the underlying concepts will remain just as subtle.

Once you're done, you should have a solid foundation to understand the changes in C99, C11, and C23.
Yes I can do most of the jobs done using Python.However,I wish to understand how computers work as a hobby(It might also be useful for doing scientific computing).I believe learning C might be logical for that purpose because allows me to get away more from the abstraction typically offer by other high-level languages we see today.
Please forgive me if I am wrong or too naive.I am a chemistry-majored person.
 
Besides K&R on that I've had for a whil "C Programmers Guide" by Jack Purdum. My 3rd edition, copyright 1988 by Que Corporation. Been a while since I've looked in it, but it does a good job of explaining concepts not just syntax.
 
C Programming: A Modern Approach is the one I'd go with. Exercises build up gradually. And since you already know Python, you'll move through it faster than a beginner would.
 
It may just be me, but the only way to really learn to program (be it C or BASIC or Pascal or Bourne shell) is to have an itch to scratch (ie want to write a program to accomplish a particular goal).

I learned BASIC to write a BBS for the VIC-20. I learned C to write utilities for the Opus BBS. I learned Bourne shell to write a web CGI based publishing system outputting SGML to print/web/CD-ROM. I learned Delphi to write tax calculators for Windows. I learned Pascal to write programs for sensors for Microchip microcontrollers. Sometimes, just for fun, I wrote the same program in BASIC, C and Pascal :)
 
If you want to learn to program then first learn how to hack something together in some language but then learn Pascal. After that you will be able to pick up any other language and use it at will.

Pascal won't pay your bills though.

Also some assembler has never hurt anyone ;^D

/grandpa
 
I am fine with the C syntax and basic programming concepts,but still I found some of the implementations in KnR to be hard understand.For example,in the chapter on functions,there was an example of a simple calculator using reverse Polish notation.I read that code along the explanation multiple times,but still couldn't understand how it works.
C is (a lot) more compact than Python; it can also be a lot more cryptic, especially when programming C in a wrong way (think spaghetti code).

This RPN example is an excellent way for some exploration and self-reflection: program a RPN calculator in Python and see if you fully understand the workings of RPN. Then look at the C implementation. You may have some difficulties in understanding RPN, its C implementation and C syntax and semantics, or even in the way it is explained. The last is possible but, when you get used to the exposition style of K&R C that would be, to me at least, somewhat unexpected. If after working with several chapters and working the exercises, you "don't gel" with K&R C, look out for something else. However, my suggestion: perseverance will pay off!

You will find that C contains a lot less guard rails; C is basically a systems programming language. One important aspect that you may not immediately come into contact with during initial learning and programming is undefined behaviour: you should get used to avoiding that from the very beginning, IMO. The ultimate reference guide for a certain C version is the C standard which I would not advise to any beginner. However, you may find it useful to have a more language reference oriented book on hand to use with your study book or material, have a look at:
 
Back
Top