Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It looks like K&R "C Programming Language (2nd Edition)" covers ANSI C, but another book that I'm starting (Stephen G. Kochan "Programming in C") says that it uses C99.

I'm coming from a C#/JavaScript/Python/PHP/Java background and looking to round out my skills.

I'm currently using GCC, but I'm curious about Clang. Which version is used more in new and existing code? Does it even matter, or should I learn both?

share|improve this question

closed as off-topic by gnat, Kilian Foth, MichaelT, GlenH7, thorsten müller Jan 20 '14 at 13:47

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "Questions about what language, technology, or project one should take up next are off topic on Programmers, as they can only attract subjective opinions for answers. There are too many individual factors behind the question to create answers that will have lasting value. You may be able to get help in The Whiteboard, our chat room." – Community, GlenH7, thorsten müller
  • "Questions seeking career or education advice are off topic on Programmers. They are only meaningful to the asker and do not generate lasting value for the broader programming community. Furthermore, in most cases, any answer is going to be a subjective opinion that may not take into account all the nuances of a (your) particular circumstance." – gnat, Kilian Foth
If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 14 down vote accepted

Learn C89 first, then learn everything that is different between C89 and C99.

A good book covering both is C Programming: A Modern Approach.

I think C89 gets used the more; GNU uses it and then, most compilers don't even support C99 (fully). GCC supports C99 only partially. Myself, the only C99 features I use are variable length arrays and single-line comments. If you want maximum portability, choose C89 for your projects, but it is still important to at least be aware of C99's features.

share|improve this answer
Great answer :) – Tim Post Apr 9 '11 at 18:26

I think you are confusing C language standards and specific extensions offered by compilers.

As for standards, I would learn the latest you can use to produce running code.

As for compiler, I would try to stay away from extensions as long as possible. Consider compiling in a highly standard-compliant mode (e.g. -pedantic for gcc and clang). This makes your code more portable and helps you understand the language better.

share|improve this answer
not only portable but catch subtle bugs too – user1249 Apr 9 '11 at 16:48

In one respect, it doesn't matter. As you build a career in programming, you're certain to encounter C, C89, C99, C++ in some variant forms, C#, Java (as a quasi-variant of C) and Objective-C (as another quasi-variant) The goal, in my opinion, would be to establish yourself as a competent programmer first, and then any language you see, including Fortran, Cobol, or Basic, will be easy to read and understand, and therefore easy to adapt to.

In that sense, an early focus on any one of those languages is fine, as long as you're prepared to adapt to the other languages as they come along.

So I say this: If you're making this a focus of academic study, then choose the most popular standard C variant in use today, and do your learning while adhering strictly to the standard set. Following that, make an analysis of the differences between your choice, and the differences.

If this is a professional focus, you're going to want to learn C# and Objective-C and know them both cold, eventually, unless you're maintaining code. And if you're a smart professional, you're also becoming expert in PHP, Python, Ruby, Visual Basic (y'know, just. in. case.) etc, etc, etc...

share|improve this answer
Or better yet, the OP should learn Java and C++. Anyone wishing to work in enterprise software development needs to know Java. C++ is still the primary language used in game development. – bit-twiddler Apr 10 '11 at 4:09
C++ as late as possible, unless you're getting into scenegraphs. And even then, kinda meh; C++ is a lexical and syntactic travesty. – Rob Perkins Apr 13 '11 at 3:20
All languages involve trade offs. The Java ecosystem is a nightmare, and C# pretty much locks one into the Microsoft world. The thing that I hate most about Java and C# is that both of these languages lack copy constructors, which makes creating deep copies of collections that contain derived classes a nightmare. There is no 100% safe way to create a deep copy of a collection that contains classes that are not derived from serializable classes in either language. – bit-twiddler Apr 13 '11 at 14:09
Just have to preempt the need with a design pattern. (C# and Java are also lexical travesties; what is "}}}}" supposed to mean, anyway, all by itself, for example? It's too implicit in places like that, and readability suffers.) – Rob Perkins Apr 13 '11 at 17:03
It is funny that you mentioned solving the problem with a design pattern. I never had to make a deep copy of a Java collection until I worked on a very large Swing-based application that suffered from design patternitis. It has been my experience that heavy use of design patterns tends to bloat the code base, which, in turn, drives up the cost of maintenance. Used judiciously, design patterns can simplify a design; however, far too many developers are making problems fit a design pattern (or a set of design patterns) instead of designing a solution that fits the problem. – bit-twiddler Apr 13 '11 at 18:46

Use the C-subset of C++. Being able to define variables close to where they are initialized and used is better than having C force you to declare a list of variables at the top.

share|improve this answer

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