In 2018, is it still worth the time to learn C? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

In 2018, is it still worth the time to learn C?

Just wondering is it still worthwhile to learn C, not C++ just regular good old fashioned C. My dilemma is, is it worth spending the time learning C when I already know some C++? Should I spend more time and learn C or keep advancing my knowledge in C++?

27th Apr 2018, 6:58 PM
Chris Kramer
Chris Kramer - avatar
43 Answers
+ 7
There are still things only done in C, but since you already know C++, you wouldn't need more than a set of compiler errors or so before you'd be able to program it. I wouldn't bother, until needed.
27th Apr 2018, 7:33 PM
John Wells
John Wells - avatar
+ 5
Are you interested in C? Or are you scared of missing something?
27th Apr 2018, 6:59 PM
Timon Paßlick
+ 5
Timon Paßlick I assume you mean my first paragraph. Some examples: C++ neatly and efficiently wraps many things due to the ever-growing STL. Take strings. std::string is a neat container where the user needn't know the implementation, just how to use it. By contrast, C strings are are arrays, and terminated by 0. For non-constant strings, dynamic memory allocation is used: the memory to be *alloc()'d and free()'d. I know new and delete in C++ could be compared here, except new requires no working knowledge of the memory requirements of the object. And on this note, consider std::vector in C++. It's a wonderful container that's safe when it comes to dynamic memory. In C we'd need to know how much memory to allocate to be efficient with a small footprint (ie enough for N more objects every K objects added). I've never looked at vector's implementation so it could reallocate every new object, but I expect it's optimised based on memory in use vs object size. In C, you'd need to track number of objects allocated for, memory in use, actual data, etc. From that perspective, you learn more about memory management and a few optimisation tricks in C. The average C++ programmer can write a game without understanding or needing to understand many deeper aspects of a machine. Of course there are aspects of C++ that are intensely complicated and in many ways tougher to grasp because they focus on design. I find the higher the level of language, the harder things can become. A good C++ programmer will understand it all, so he'll have some computer science knowledge, but there are loads of programmers who learn programming (in any language) for a single purpose.
28th Apr 2018, 10:51 AM
non
+ 4
No, you can do fine without it. Because in that time, you can learn assembly language or advanced C++ concepts.
27th Apr 2018, 7:02 PM
Timon Paßlick
+ 4
More than C++.
27th Apr 2018, 7:05 PM
Timon Paßlick
+ 4
It can be good to learn C as a precursor to learning C++. C is like a halfway jump to C++ in some ways. However, learning C++ straight away is also good. C++ is more common as a job.
27th Apr 2018, 7:07 PM
Emma
+ 4
nonzyro Can you give an example of these things, please?
28th Apr 2018, 7:38 AM
Timon Paßlick
+ 4
KrOW True, but understanding what's happening at a lower level, can increase your understanding. This is true for learning anything. Master the basics first. What is a bit? What is a byte? What is an integer? What's a memory address? What's a pointer? etc. No shortcuts to greatness.
28th Apr 2018, 11:27 AM
Emma
+ 3
C is (almost) a subset of C++ and latter provide you ability of apply a better programming paradigm (OOP).. In practice if you know C++ then you know C but you can have some advantages then I suggest advancing C++ knowlegments (that opposed to what most users think, its a very difficult language to master deeply)
27th Apr 2018, 7:32 PM
KrOW
KrOW - avatar
+ 3
I understand your position nonzyro but in C++ you can use std::string or null-terminated array chars (like C) or any custom string class... Its true that C force you to understand some concepts and its right for this type of language but the good thing of C++ is that you have some types yet prepared for use. Think about a beginner that want learn a powerful language. C++ is a good choose because its between a low-levele language (like assmebly family) and high level language (like Python). You can use some facility but nothing force you to not use lower level concepts like custom memory allocation. More it allow to be (almost) compatible with C codes and allow a better programming paradigm thats OOP (this can be relative but i think that it in most context help to build better sotware ) but here also not force you to use it. Anyway C also abstract you from computer architecture (and is right) when if i want understand like a computer work, i have to learn computer architecture and i think is good for all programmers
28th Apr 2018, 11:25 AM
KrOW
KrOW - avatar
+ 3
Yes but you dont know that i must update me to newest standards of C++ 😁😁😁... Anyway it was an example for support my comment but thanks for precisation 👍
28th Apr 2018, 11:47 AM
KrOW
KrOW - avatar
+ 3
nonzyro You can do more with C++ classes than with Java classes, for example operator overloading, and you don't have these "Program" classes with static methods and members only where you think: Why must I put this in a class?
28th Apr 2018, 12:17 PM
Timon Paßlick
+ 2
No, not particularly interested in C. I enjoy C++, but will I miss something from not taking the time to learn C?
27th Apr 2018, 7:01 PM
Chris Kramer
Chris Kramer - avatar
+ 2
Martin Taylor C++ > C ==> C < C++ 😁😁😁
27th Apr 2018, 8:33 PM
KrOW
KrOW - avatar
+ 2
C gives you understanding of certain things C++ doesn't. Will it get you a job? Lol, C++ barely does today. C is still relevant to some (kernel devs to indie game makers). It's an easier language than C++ in size and simplicity. Whether you learn it is up to preference.
27th Apr 2018, 11:56 PM
non
+ 2
Xan Its really true and i have not opposed never to this but really C++ dont make you know about this things? Pointer concept exists in C++ also and though exist some facilities (like auto_ptr and related that help to not make some common errors) you have to know what are a byte, size of data etc... Futhermore i want note that today programming is not understand computer system only. Now code architecture (or software architecture) belong to programming almost like computer architecture and sorry but i think that with C and similar languages will penalize you on this side
28th Apr 2018, 11:41 AM
KrOW
KrOW - avatar
+ 2
KrOW Note that auto_ptr is deprecated since 2011. We have unique_ptr and shared_ptr and other more rarely used _ptr classes now.
28th Apr 2018, 11:44 AM
Timon Paßlick
+ 2
True ☺
28th Apr 2018, 11:44 AM
Emma
+ 2
So on balance, they should probably go with C++ ☺
28th Apr 2018, 12:06 PM
Emma
+ 2
KrOW You misunderstand. The question was what did I mean by "things"? I answered. On a different note... Your examples aren't wrong per se, but: *. C++ is mostly not compatible with C. C is always compatible with C++ (I'm talking zero-dependency source). *. For all you know, a std::string uses no null-terminator and stores string length in the first 4 bytes, returning str[4] when you reference str[0] (it probably doesn't, but the underlying implementation is trivial, that's the point). *. If you're learning C++, but only using manual memory allocation, primitive types, no safe pointers, etc, then you're not learning C++, you're learning C with the wrong header names. *. Procedural programming is way easier to learn than OO. Anyway, C++ is not a good language for OOP, Java is. C++ is multiparadigm. It's not as disciplined either. *. C is a tiny language with little change. For a learner, that's a better start. Going on to C++ is like an upgrade of having the STL and new paradigms. *. The only advantage to C++ as a first language is that it makes learning C++ easier and probably makes a better C++ programmer. *. Every modern language abstracts you from the computer to some degree. I'm not saying C is better, it's not for most people in most situations, I'm just noting some points worth considering as far as "should I learn C?" go. I'm also providing food for thought since you brought it up.
28th Apr 2018, 12:08 PM
non