• Support PF! Buy your school textbooks, materials and every day products Here!

Learning C Programming

  • Thread starter AlexVGheo
  • Start date
  • #1
28
1

Main Question or Discussion Point

Hi, could anyone recommend me a good book for learning C programming? I know that there are lots of good website but I would prefer a solid book, however without reading them before hand naturally I can't determine a good one!

So any advice on this specifically would be good thank you. Or any advice on learning C in general would be very welcome too
 

Answers and Replies

  • #2
Borek
Mentor
28,398
2,800
Do you know anything about programming, or is it your first attempt to learn programming at all?
 
  • #3
nsaspook
Science Advisor
937
1,347
Do you know anything about programming, or is it your first attempt to learn programming at all?
Good question.
I don't recommend C as a first programming language, it's like learning to walk on a tight-rope. You can do amazing programming tricks with it using very limited resources but it's a maze of death-traps for beginners.
To the OP:
If you're not a new programmer then this is the book to start from.
https://www.amazon.com/gp/product/0...=1789&creative=390957&creativeASIN=0131103628
 
  • #5
181
3
Do you know anything about programming, or is it your first attempt to learn programming at all?
Also, what is your environment, and what is your objective? Do you really mean C, or do you mean C++? Are you on Linux, or Windows, or something else? Do you plan to use gcc, or Visual C Express, or something else as a compiler? Do you want to become a professional programmer, or do you just want to write programs for yourself?
 
  • #6
28
1
I was considering it more for a bit of fun, and I have done some programming in the past like VB and Ruby and a bit of Python. I am on Windows but I dual boot with Linux if that is a better environment for doing it on. I have never writen in C but I have a friend who has been trying to learn so I know at least the basics of it, like 'if' and 'while', are much the same as what I have done before.

Ill have a look at that book you linked, thank you all for the help
 
  • #7
CompuChip
Science Advisor
Homework Helper
4,302
47
Actually if you want to start with a C-like language, I would really recommend learning C++. It will also teach you things that are not directly related to the language but to good programming skills in general.
 
  • #8
nsaspook
Science Advisor
937
1,347
but I dual boot with Linux if that is a better environment for doing it on. I have never writen in C but I have a friend who has been trying to learn so I know at least the basics of it, like 'if' and 'while', are much the same as what I have done before.

If you program while running Linux, using a IDE like Netbeans can help you with some of the many details of C (and other language) programming.

https://netbeans.org/
 
  • #9
990
57
I would get the classic text:

31euHZManML.jpg


As for learning C++ as suggested by another poster, I would suggest keeping a strict separation in ones mind between ANSI C and C++ (which is not strictly a superset of C). It's common for people to conflate the two. Most C code out there is standard ANSI code. If you're collaborating with other people, mixing the two will probably not be appreciated. Compilers and tools usualy have a way to make sure your code follows the ANSI standard (e.g. -ansi switch in gcc).
 
  • #10
192
41
Isn't K&R a bit too heavy for someone willing to learn C for fun?
I would suggest this book:
Miller, Quilici
The Joy of C
519uKIrMeaL._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA300_SH20_OU01_.jpg

https://www.amazon.com/dp/047112933X/?tag=pfamazon01-20
(it's a bit pricey now, but look at the used copies)

It gives a step by step introduction to the language and it's not one of those "hello boys and girls, I am your new teacher so let's start looking at some funny pictures to motivate you before starting to give you - in chapter 85 - some useful information". And yet, you can almost hear someone playing the ukulele in the background.

K&R can be a useful reference, but starting with that... ugh.
 
  • #11
15
2
Isn't K&R a bit too heavy for someone willing to learn C for fun?
K&R can be read by anyone still in high school. It is very well written, accessible and short.

As for the above recommendation to start with C++, it's a terrible suggestion.
 
  • #12
192
41
K&R can be read by anyone still in high school. It is very well written, accessible and short.
I don't dispute that. But it's not exactly a very friendly text to start learning C from scratch.

As for the above recommendation to start with C++, it's a terrible suggestion.
The OP question was "Hi, could anyone recommend me a good book for learning C programming?"
I must have missed a step (the one with the increment).
 
  • #13
990
57
The OP question was "Hi, could anyone recommend me a good book for learning C programming?"
I must have missed a step (the one with the increment).
A lot of people seem to think there's a language called C/C++. I blame Microsoft.
 
  • #14
990
57
I was considering it more for a bit of fun, and I have done some programming in the past like VB and Ruby and a bit of Python. I am on Windows but I dual boot with Linux if that is a better environment for doing it on.
For windows, you can download and use Visual Studio Express for free. Or MinGW if you want something open source.

Here's a howto for Ubuntu, which will probably work for other Debian derivatives:

https://help.ubuntu.com/community/CompilingEasyHowTo

These days I never write C code. I use Python's ctypes module to interface with C DLLs and cython to speed up bottlenecks in my Python code. I still need to read legacy C code, though.
 
  • #15
verty
Homework Helper
2,164
198

Related Threads on Learning C Programming

  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
21
Views
6K
  • Last Post
Replies
12
Views
10K
  • Last Post
Replies
5
Views
2K
Replies
7
Views
1K
  • Last Post
Replies
8
Views
2K
Replies
3
Views
1K
  • Last Post
Replies
6
Views
1K
  • Last Post
Replies
4
Views
9K
  • Last Post
Replies
2
Views
2K
Top