Thread: C and C++

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Location
    US
    Posts
    7
    Rep Power
    0

    C and C++


    Hello members,
    which is the best book to learn C and C++ for a beginner,
    I want to learn c and c++ from the beginning please help me...

    Comments on this post

    • Scorpions4ever disagrees : Yet another SEO who's so ashamed of his country that he has to lie about being from the US.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    3
    Rep Power
    0
    Originally Posted by johnmark03
    Hello members,
    which is the best book to learn C and C++ for a beginner,
    I want to learn c and c++ from the beginning please help me...
    I am using C++ without fear 2nd edition by brian overland seems ok...
  4. #3
  5. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,114
    Rep Power
    1803
    Go to your preferred on-line book store, read the reviews and the previews where available.

    I would suggest that C and C++ implies two separate books not one. I would also suggest that if you learn C++ you really don't need to learn C unless you are going to be coding for platforms with no C++ compiler - and that generally applies only to some but by no means all 8 and 16 bit embedded micro-controllers.
    Last edited by clifford; March 22nd, 2013 at 12:08 PM.
  6. #4
  7. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,183
    Rep Power
    2222
    A few questions for you, even though Clifford already covered one of them:

    1. Are these your first programming languages? Or do you already have programming experience?

    It's kind of like learning your first dance or your first foreign language: there is a lot of foundational knowledge and skill proficiency that is common to all dances/foreign languages/computer languages and that has to be learned with the first dance/language/language you learn, thus making that first one so much more difficult than the second, third, etc.

    Similarly, some books on a specific programming language take you through that entire first-language evolution while others assume that you already know how to program so it goes straight to the language itself. Because of that, if we knew whether you are an experienced program or a complete beginner would be a factor that we would consider in our recommendations.

    2. Which language is your goal? Is it really just C++ and you view C as a prerequisite? Or do you really want to be proficient in both?

    Now, this has been known to spark religious wars here, but I generally advocate learning C first and then C++. However, that is only if you want or need to be proficient in both. If your ultimate goal is C++, then by all means go straight to C++. The main reason for me to advocate that is because the books that teach C++ make absolutely no mention at all of certain features of C (mainly I/O functions and C-style strings, which are also supported and can be used in C++) which then completely baffle the student when he encounters them later on.

    Furthermore, up until the new standard in 1998, C++ used to use C-style strings, but the 1998 standard introduced a basic string class that is a lot easier and safer to use. New C++ books will only teach that new basic string class, but older books and a lot of older code out there, plus newer code written by older C++ programmers who had never gotten around to learning that new basic string class, will use C-style strings. So even if you're just going straight to C++, you need to learn and understand C-style strings, which you won't learn in the new C++ books, which means you'll have to learn about them in C books.

    Now, because C++ is largely a superset of C, that means that if you learn C++ then you will have learned over 90% of C. And that if you learn C, you will have learned more than 50% of C++ (very rough estimate). Thus, it would make a lot of sense to learn C++ first and then go back and fill in the holes in your knowledge of C. The approach that I generally advocate, learning C first, offers the advantage of having learned the C-specific things (ie, I/O and C-style strings) as well as most of the syntax of C++; its main disadvantage is the learning of habits necessary in C but replaced in C++ with something easier and much better -- one view of C++ is that it's "a better C".


    Unfortunately, I learned C and C++ over 20 years ago, so I'm not familiar with the books that are currently in print. I would also not be able to evaluate a book for a beginner, since I've forgotten what it's like to be a beginner.

    The book I learned C from, From C to C, is long out of print and the only thing I really remember about it was that it had a good appendix describing the standard library functions. I can, however, recommend a good reference and study guide, Schaum's Outlines Programming with C (2nd ed) by Byron Gottfried. It does an excellent job of explaining features of the language; its chapter on pointers alone is worth far more than the price of the book, which is less than $20 USD. I've also seen where it's supposed to be available on-line as a PDF for free download.

    I will only mention Kernighan and Ritchie's The C Programming Language. Dennis Ritchie, recently deceased, was the designer of C and Brian Kernighan was part of the team that designed UNIX; Kernighan also invented the "Hello, World" program that is everybody's first program in every language. The first edition of the book was the manual for C. However, it both is very densely packed with information and assumes that the reader is already very knowledgeable about programming, so I cannot recommend this for a beginner. But as you gain more experience, this book should eventually find its way to your bookshelf.

    When I learned C++, I got the most from Stanley B. Lippman's C++ Primer followed by Scott Meyers' Effective C++, though Meyers' book is best read after you have started becoming proficient in C++. I don't know what edition of Lippman's book I had read circa 1990 and, since I had already had over a decade of programming experience, I don't know how accessible it is to a beginner. His third edition, co-authored with Josée Lajoie, was published in 1998 and includes the new features added to C++ at that time.
  8. #5
  9. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,114
    Rep Power
    1803
    Further to dwise1_aol's advice, to learn C++ as "standalone" first language rather than as a "graduation" from C, then you could do worse than "Essential C++" by Stanley B Lippman. It covers procedural, generic, object-based and object-oriented programming techniques all in C++ from the ground up.

    I believe many programming courses teach C then C++ because that is how the teachers learned - they may have had no choice since C++ may not have existed when they started out, or they may be "second generation" and are simply propagating the approach they were taught by the "first generation". However as more-or-less a superset of C, you can use C++ to learn all that C might teach you. I work in embedded systems, and even there I have largely ceased using C.

    The advantage of learning C++ before or instead of C is that you do avoid habitually using C constructs where C++ provides better alternatives. I see a lot of C++ code that looks a lot like C code and therefore shares its flaws and dangers.

    C is not a bad language, it is small, compact and simple. C++ includes all those features, and then provides further tools that can make code simpler, more elegant, and more robust.
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    India
    Posts
    4
    Rep Power
    0

    which is the best book to learn C and C++ for a beginner,


    Originally Posted by johnmark03
    Hello members,
    which is the best book to learn C and C++ for a beginner,
    I want to learn c and c++ from the beginning please help me...
    Hi, all of you.
    C and C++ are both very important languages for everyone who want to learn programming.
    i think to learn c language best book is "Beginning C Programming" by Horton.
    and to learn C++ best books are:
    1) C++ Programming in Easy Steps
    2)Sams Teach Yourself C++ in One Hour a Day (7th Edition)
    3)C++ Primer Plus (6th Edition)
    4)Beginning C++ Through Game Programming
    are sufficient to learn a good C++ language. :tblue:
  12. #7
  13. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,642
    Rep Power
    4247
    Ok, this thread now has two SEO replies here and I'm not fully convinced that the OP really is interested in C or C++ in the first place. I think there are some valuable posts in between, so I'd like to keep this thread. Anyone NOT in favor of thread lock, please post your reasons below.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo