r/AskComputerScience • • Sep 10 '19

Should i learn C in 2019?

Hey I just want to get opinions about should I learn C in 2019? Is it worth it to put time into it ?Where it is used?and is it still relevant where languages like Python and Java are there.

53 Upvotes

26 comments sorted by

40

u/gab800 Sep 10 '19

IMHO, yes. Mostly to learn pointers. Even if higher level languages won't have them in their syntax, the concept is still there.

You will also appreciate more the garbage collector in managed languages ;).

4

u/011101000011101101 Sep 11 '19

Honestly, learning C will just make you hate pointers with a burning passion as you debug a bug for a week that turned out to be a missing * or &. I found perl's ref/deref much easier to pick up personally.

37

u/Felicia_Svilling Sep 10 '19

Yes. It is still one of the most common languages, and one that is different enough from most other popular languages that you can't just pick it up in an afternoon.

18

u/Senator_Ahn Sep 10 '19

i learned C not because I thought it would directly help me get a job, but because I wanted a more indepth understanding of programming.

1

u/foadsf Sep 10 '19

then try opencl too 😉

4

u/Senator_Ahn Sep 10 '19

oh hell no dude lol C is my limit

7

u/kaktusas2598 Sep 10 '19

If you are interested in micro controllers, embedded systems and robotics, C is number one! Even if you are not, I suggest learning it, buy an arduino, it is tons of fun!

6

u/khedoros Sep 10 '19

I do most of my work in C++, and lean somewhat on the C ecosystem of libraries. So it's still necessary for me, sure.

Particularly conservative groups sometimes still use it for new development. Even without that, I don't think it's going anywhere anytime soon, just because of maintenance requirements for all the existing code.

and is it still relevant where languages like Python and Java are there.

The main implementation of Python is written in C. And lots of Python modules are primarily bindings to C libraries. Python, C, and Java live in different worlds. Python's fairly slow (assuming you're writing pure Python, and not dropping into natively-implemented libraries). Java's really fast, but there are still cases where the runtime environment won't fit on the hardware (thinking of embedded devices, especially), or where you can't take the little garbage collection pauses (makes it tough for anything realtime, or for games, for example).

So, you still see C in some systems programming, embedded, things that directly interface to hardware, that kind of thing. Games were written in it for a long time, and sometimes still are (although anything Unity will be C#, and most other devs will be using C++).

Should you learn it? Probably, if you're interested in going into systems+embedded and such. I don't believe that much new software should be written in it, unless it's a technical necessity; there's almost always a better option out there.

1

u/cowboy_feetrex Sep 10 '19

Thanks to all for your feedback.Now I know should I learn or not.The biggest advantage of C language is it's speed cause most newer languages don't run code at the speed that C language does so it's also beneficial in that sense also.Even if it takes time to write more lines of Code in C language,I think its worth it.

4

u/roystgnr Sep 10 '19 edited Sep 10 '19

You really ought to first consider what sorts of programs you're planning to write. C and C++ can indeed be much faster than the alternatives, and if you have some processing task which will take an hour in C or twenty hours in raw Python then maybe that's worth it, but many programs spend most of their time waiting on user input and have processing tasks which take milliseconds in C or tens of milliseconds in Python, and that's often not worth it.

More subtly, consider that you can write Python without writing "raw Python"; I mostly use C++ myself, but I know a lot of high performance computing codes which are technically "written in Python", but use NumPy or Cython or some such for all the expensive kernels, which at least for large blocks of data gets you within spitting distance of C.

2

u/xJuddi Sep 10 '19

C is a much lower-level language than most mainstream languages that are advertised nowadays. If you really want to understand what you're doing, C is a great place to start. If you want to be known as a script kiddie and not actually understand what you're doing when you're programming applications, then just learn python and other higher-level languages.

It's easier to get going with the advertised languages, but it's also extremely easy to get lost and not understand what you're really doing. As a developer I highly recommend learning C as you're main low-level language to appreciate and understand what's really happening.

13

u/visvis Sep 10 '19

Yes, you should definitely learn C/C++ in 2019, and many universities teach it as part of their computer science curriculum, often even as the first language. It is important to learn these languages not just because they are widely used (and will be for many years to come), but also because they help you better understand how a computer works at a low level. A programmer who knows only, say, Javascript or Python would have no idea what happens behind the scenes and have a hard time writing truly efficient programs.

Also, once you know C/C++ well, most other languages would be trivial to learn. That does not work the other way around.

8

u/[deleted] Sep 10 '19

C is used for drivers and embedded devices with very limited resources. Depending on what kind of job you want this may or may not be worth it to learn.

I found that knowing some fundamental C was helpful for learning other languages as the syntax and semantics had a huge impact on many imperative languages that are big these days. Also, it helps understanding if you are interested in how the C-based python implementation works in detail.

Side note: I believe Java is considered old and needlessly verbose.

3

u/[deleted] Sep 10 '19

C is not a huge language. Frankly I think anyone who's not just dabbling in programming owes it to themselves to be able to write basic C programs at least.

2

u/EatItLoser Sep 10 '19

Yes, even if you don't work in an area that uses it (microcontrollers, OS, etc) it will help you understand better why some more modern languages behave the way they do.

2

u/claytonkb Sep 10 '19

C is the primary language in which the Linux kernel is written. That alone makes it pretty significant.

1

u/chris1666 Dec 08 '19

Well put,

3

u/oligIsWorking Sep 10 '19

Yes, I mostly work in C.. python is a lovely utility and useful to know, there are many many many things I would do in Python over C.... Just don't Java.

3

u/[deleted] Sep 10 '19

Why not java

2

u/oligIsWorking Sep 10 '19

I think you have to first ask the question why Java?

1

u/Syde80 Sep 10 '19

Take a look around at how many other languages compilers or interpreters are written in C.

1

u/n1vgabay Sep 10 '19

Isn't C/C++ are the base for all the codes languages in the world those days?
Basically from my understanding, phyton, ruby, java, etc.. are compilers/interpreters like you said.

2

u/Syde80 Sep 10 '19

A very large amount yes. C (and ++) are very important languages. They might not be important to you as a software dev making an end product... But overall they are still exceptionally important languages.

2

u/Tai9ch Sep 11 '19

AFAIK the only significant language ecosystem today that isn't built on C is Common LISP.

Some languages are mostly independent from C with bootstrapped compilers - like Haskell - but they still rely on historical C code for re-boostrapping and C interop for significant portions of their standard library.

1

u/Tai9ch Sep 11 '19

Yes. C is the bedrock that everything sits on. When you interface with the OS, it's C code that actually does the work, and being able to write some of that interface code yourself can be extremely useful even when your program is (mostly) written in some other language.