Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I know Java and JavaScript pretty well. I have never really worked on C/C++. But at this stage of my career I feel that the fact that I do not have adequate knowledge on C/C++ syntax(especially pointers *), I am missing out vital parts on reading some classic books in the field of software programming. Here are some of the books that I would like to read and understand thoroughly but unable to comprehend the example code as I do not know the C/C++ syntax:

  1. Advanced Programming in the Unix environment where C is used.
  2. GoF book where examples are in C++/Smalltalk .
  3. Algorithm Design Manual by Steven Skienna where again C is used.

I do not intend to work on C/C++ projects. So I do not want to spend a whole lot of time learning the intricacies of these languages but I would like to at least have some working knowledge so that I can understand at least 80% of the examples in those books. I do not want to miss out on the essence of these classic books. What should I do about this?

share|improve this question
If you want C/C++ knowledge... write programs in C/C++. There is no other way. –  JoelFan Jul 31 '13 at 19:37
Do you want to learn C or C++? Those are two very different languages and the answers are very different. –  Timo Geusch Jul 31 '13 at 19:48
what do you mean there's no other way?? what about osmosis: Buy a C++ book that got the best reviews and put it under your pillow every night before going to bed. –  DXM Jul 31 '13 at 19:48
Yes, you can. You'll pick up most of C along the way if you write procedural C++. I'd argue that if you want to learn C++ rather than C, you are better off learning C++ without knowing C anyway. –  Timo Geusch Jul 31 '13 at 19:59
Write code. That's all. Thank you. –  Robert Harvey Jul 31 '13 at 20:29
show 6 more comments

closed as primarily opinion-based by gnat, BЈовић, Kilian Foth, Eric King, Jimmy Hoffa Aug 2 '13 at 14:17

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers

up vote 3 down vote accepted

I agree that the best way to learn C or C++ is to write programs in C or C++, but I'll elaborate a little more. If you just read a few books on C or C++, you'll probably see lots of details about all areas of the language and have a hard time remembering the "core working knowledge" you'll need to understand code examples in software books. (As an aside, you really should decide which language you want to learn, since C and C++ are not really interchangeable.) On the other hand, writing some programs in the language will force you to become familiar with the parts of it you use most often, and give you a more intuitive grasp of what code will do.

You don't need to write very difficult or complex programs to get enough working knowledge of the language to read an algorithms book. Perhaps this is my bias as a recent college graduate, but I think the best way to try writing some programs in (for example) C is to find an intro-level college CS course that's either language-agnostic or designed for C, and complete some of the assignments in C. Especially if you learned Java by taking a similar college course, the programs will be conceptually easy, so you'll be able to focus most of your effort on figuring out how to do things in C and getting the hang of the language.

share|improve this answer
add comment

I would start with C, as the object orientedness of C++ is covered by Java, and other aspects, templates / libraries, are better served with hand-on studying, programming in C++.

However C is a very early language, more packing up assembly, than doing language concepts. Indeed from Pascal/Modula-2 one might learn more on pointers, arrays, structs, unions, parameter passing. Pascal offers a more direct model. In C "everything is a pointer." And the language is intentionally unsafe; later in history some safeness was added.

To a novice I would definitely advice not learning C, as the chance of acquiring fuzzy notions of many things is too large. Furtunately you are no novice, and C is definitely worth learning.

  1. Start as a novice would, with learning the basics.

    • Arrays are pointers, indexing is pointer addition, pointers of pointers, function pointers. Basic concepts and syntax using *&() needs to be understood.
  2. Go for Linux code, refrain from Windows code, if possible.

    • The MS C things embellish their code with numerous prefixes and might be not so alluring to a Java developer.
  3. Work on small projects, inspect existing code.

    • GNU/Linux knows many small, isolated commands, like grep, wc, ls, diff, patch. Their source code might be of interest.
  4. Make a list of small tools you might like to develop: for me that would be i.a. analysis what encoding/language a file is in, programming for the Raspberry Pi, mini-database, SQL parser to internal query expression tree.

share|improve this answer
add comment

if you just want to know the basic concepts of this language, I think google is the best tool. In C++, you could learn how to define a class, how to use its members. In C, you should know how to define a variable, how to make math operation, how to usr control stream, and how to define and use function. Hope to help you.

share|improve this answer
add comment

You can start with 'The C++ Complete Reference' book. This book has two parts. One is C part and another is C++ part.

You can download the source code of this book from publisher website. Work with the examples of this book.

After getting some basic knowledge you can start coding which makes you professional.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.