Learning C after C++

I really like C++ but when I'm looking at job offers people are always looking for C/C++ developers instead of just C or C++. So basically I know I'm going to have to learn it sooner or later when I'll reach good level with C++.

So my question is how easy/hard would it be to learn C if I would know C++ pretty good? Actually I should ask how time consuming it would be because I don't care if it would be hard or not :D
Last edited on
C++ is almost a superset of C, so if you know C++ you already know C as far as the language goes. Though programming in C requires a very different style and mindset because you have different tools available. And in fact, while C as a language is simpler (in that it has fewer rules and is a much smaller language) -- actually making a full program in C is more difficult because you have fewer tools available to you.


Main differences between C and C++ is that C does not have any of the following:

- classes
- templates
- function overloading
- operator overloading
- member functions
- inheritance
- constructors/destructors
- exceptions
etc


The standard library for C is also much smaller as a result. No classes means that string, vector, map, etc are not available. No ctors/dtors mean that all memory initialization and cleanup has to be explicit which means you have to be much more careful about leaking memory. No string class means you have to work with memory buffers directly which means you always have to be wary of buffer overflows. Etc, etc, etc.
There's also expected differences from the community.

C developers expect the use of goto statements, macros, and heavy use of pointers. C++ developers tend to look down upon these things and use alternatives such as exceptions, templates, and reference types instead, respectively.

It's not hard to program in C if you are truly familiar with C++. However, what the community would consider clean C code is an acquired taste to anyone starting to program in C and especially so from someone coming from C++.
Really nice answers guys. Thank your very much this was useful info :)
Topic archived. No new replies allowed.