1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Learning C Programming

  1. Sep 11, 2013 #1
    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
  2. jcsd
  3. Sep 11, 2013 #2


    User Avatar

    Staff: Mentor

    Do you know anything about programming, or is it your first attempt to learn programming at all?
  4. Sep 11, 2013 #3


    User Avatar
    Science Advisor

    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.
  5. Sep 11, 2013 #4


    User Avatar
    Gold Member

  6. Sep 11, 2013 #5
    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?
  7. Sep 12, 2013 #6
    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
  8. Sep 12, 2013 #7


    User Avatar
    Science Advisor
    Homework Helper

    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.
  9. Sep 12, 2013 #8


    User Avatar
    Science Advisor

    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.

  10. Sep 12, 2013 #9
    I would get the classic text:


    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).
  11. Sep 12, 2013 #10
    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
    (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.
  12. Sep 12, 2013 #11
    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.
  13. Sep 12, 2013 #12
    I don't dispute that. But it's not exactly a very friendly text to start learning C from scratch.

    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).
  14. Sep 12, 2013 #13
    A lot of people seem to think there's a language called C/C++. I blame Microsoft.
  15. Sep 12, 2013 #14
    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:


    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.
  16. Sep 13, 2013 #15


    User Avatar
    Homework Helper

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted