Do I need to learn C language?

Hey FCC campers,
Well the C language is the father of programming, am wondering if i need to learn C even if am not gonna use it ! If yes why ? If not why ?

learn what you need to learn, learn what you need for your projects or job

or learn it because you think it’s interesting

you don’t need to learn anything in particular tho

5 Likes

Hi Shinichi.

The UNIX Bell Labs team (Brian Kernighan, Dennis Ritchie and colleagues) created C because they wanted something more flexible than the FORTRAN, COBOL, Algol, PL/I languages that ruled the computing world in 1970. They originally created it to be simple, so they could build out the various parts of UNIX . Linux and FreeBSD are the heirs to their UNIX, and are everywhere.

Why learn C? Here’s why.

  1. to learn how to create simple programming tools in the Linux environment. By using C you’ll get some down-to-the-metal experience with core Linux concepts like processes, pipes, filesystems, etc. That experience will serve you well when you use other languages.

  2. if you want to do embedded-systems programming (that is, make programs for devices).

  3. if you want to work on systems like games where performance is everything.

Why not learn it?

  1. Its text-handling is dangerously lame, and you can pick up the kind of habits that benefit cybercreeps more than anybody else.

  2. Debugging C programs is a colossal pain in the xxx neck. It doesn’t have exceptions. It does have some decent debugging tools, though.

If I were you I’d learn it well enough to do a few things in the LInux world I mentioned above.

4 Likes

I’m a big believer of learning a language or tool when you have a reason to. Without the motivation and direction of a goal I care about, I tend to find myself with a grab-bag of knowledge that I don’t know how to apply.

2 Likes

Hey @Shinichi!

C Helps me lot of ways, mainly JavaScript.

1 Like

Do I need to learn C language?

No.

Should you?

If you want to sure. I’ve dabbled in it myself just out of interest. I’ve been doing this for 5 years and it hasn’t been useful to me but I don’t regret learning a little either. It isn’t going to get you any closer to landing your first entry-level dev job though if that’s what your goal is.

3 Likes

Learning a new language can be valuable because it can expose you to concepts that other languages you are familiar with may not have. For example, C will introduce you to the wonderful world of pointers and memory management, something you can pretty much ignore with javascript. A new language can also give you new insights into how to solve problems. And C will get you closer to the hardware so you might learn a little more about the nuts and bolts of how computers execute that set of instructions you are giving it.

Is it essential you learn C to do web development? No, you can get by without it. Although as WASM becomes more prevalent down the road it may be to your benefit to learn C/C++, Rust, or something similar to make you even more employable.

If you have the free time and are looking for something new and interesting then there is no harm in learning C. But don’t bite off more than you can chew. If web development is your goal then concentrate on that first and make sure you are proficient before you decide to spend a considerable amount of time learning something else.

1 Like

I agree that you should only learn what you have an actual reason to.

That said, JavaScript should not be the only language you learn either, and learning multiple languages that are all fundamentally different will help you to become a better programmer.

JavaScript is a very lax language in what it allows you to do. C is the opposite and is extremely strict. Learning C will help you learn more about how computers & memory work, and how to write “optimal” code that you would never otherwise learn just programming in higher-level languages all the time. With C, you have to write code in certain ways that almost no other language will allow you to get away with not doing (including its direct successor C++), and you will almost certainly learn a lot too.

Basically you don’t have to learn C, but it has the potential to turn everyone who does into a better programmer. Or you could go with C++ which is a little bit more accessible and follows way more OOP principles, and will still allow you to learn most of what makes C different from almost every other language.

1 Like

Learning multiple languages is a good idea, and I think learning about pointers and memory management helps you write better code in high level languages.

Personally though, I would not call C strict. It is unforgiving, but extremely permissive. But the language does less work for you and you need to implement many things by hand.

I don’t find C++ terribly accessible if you are just going to dabble a bit to understand low level concepts. C++ has the worst problems of both high and low level languages.

2 Likes

Hi, @Shinichi,
Knowledge will never been to your disadvantage. Try to learn. Everyone on the forum will help you.

1 Like

Nitpicky, but I thought that by most measures C is considered weaker than JS, given it’s not really strict at all

Anyway, learning different languages with different approaches helps one better understand programming, and it’s generally time very well spent but it’s also generally not immediately helpful. I’m getting better at Rust, but I don’t [currently] use it for anything, so in that sense it’s just for personal exercise. But at the same time I’m finding that I’m constantly thinking about what code is using what memory when I write JS, which is a generally good thing.

6 Likes

I suppose it depends on your perspective. :wink: I was primarily thinking of C’s strong typing and highly procedural way of executing code in the comparison to JavaScript - i.e., with JS you could change types on a variable if you really wanted to (which C won’t allow), and you can run functions before you define them (which C won’t allow either) due to hoisting.

This is what I mean by nitpicky, sorry! I get there’s no agreed upon definitions, but think you mean statically typed? C afaics is extremely weakly typed (you can cast any type to any other, you can just tell the compiler that it’s a different type and it’ll believe you)

“To this day, many C programmers believe that strong typing just means pounding extra hard on the keyboard.”

The definitions are pretty useless anyway, as nobody can agree what they mean. I guess it would be relatively uncontroversial say ML and Haskell are examples of strongly typed languages because they can guarantee there aren’t runtime type errors (Ruby, Python etc are strongly typed as well, but they can’t guarantee no type errors prior to running the code because they’re not statically typed)

1 Like

I suppose I did mean that C is statically typed, as opposed to strongly typed.

However, what I meant more was that C’s compiler ensures that all variables have a certain type, and won’t let programmers make unintentional errors in that aspect. The pointer typecasting is something you have to do on purpose to get around that. That’s why I consider JavaScript more lax, since it doesn’t do any type checking and for the most part lets you do what you want to (whether on purpose or not).

Just to be clear. You do not change the type, you change the value.

let number = '123';

// Number takes the string and returns a new value that is of type number
console.log(typeof Number(number)); // number

// It does not change the type of the original value
console.log(typeof number); // string

I started out in C (semi-professionally). I liked it. I think I learned a lot from it. There are JS and computer concepts that I seem to understand better than some of my younger, “non-C” friends do, because I had to deal with them on a low level in C.

Do I advise people to learn C? No. The amount of time it would take is not worth the benefit. Unless you need C are are planning on specializing in something where C is important.

It would be like saying, “I want to learn Italian, but first I’m going to work on Latin for 5 years because it is the ‘mother of all languages’” (At least from a western European point of view, kind of.) True, learning Latin would make it easier to learn Italian and understand some where it comes from. But the time lost not studying what you want to study would far outweigh that.

And Is C the “father of programing”? There were dozens and dozens of languages before that. Why not study Assembler? Do it on punch cards? Hand solder relays and vacuum tubes? Should our Italian student study Etruscan before Latin? Maybe Proto-Indo-European?

4 Likes

Yes and no. C will do some type coercion for you and you can typecast willy-nilly with it making zero sense and the compiler just accepts it. The void type makes it pretty easy to muddle types.

Yeah, my experience with C and its “strictness”…

I can’t really say that it’s more or less strict than JS. I mean JS is more lax about types, imho (only one number type, etc.) but C will let you index past the size of an array and overwrite another data structures memory. There are many languages that are much more strict than either.

I guess I think that C’s value (at least in terms of teaching) is that it is so low-level - you really have to think about things like memory, addresses, etc. You have to be more aware of things that JS does for you in secret.

But again, unless you need to study C, or are one of those people that only sleeps 2 hours a night and are bored, I wouldn’t bother; with some diligent study, there’s nothing that you can learn in C that you can’t learn elsewhere.

2 Likes

Do I need to learn the C language: As others have said, need is not really why you would learn it. I became interested in C thanks to the awesome CS50 lectures (see freecodecamp.org’s YouTube channel) where the instructor led us through the fundamentals of computing and all the way to current languages, in a bird’s eye view of the landscape. It is a challenging language and in my opinion, if you can grasp it, most others would seem like ‘a walk in the park’ by comparison.

Why not learn C: well, it’s a matter of priorities. If you are short of time or have a deadline within which to accomplish something that does not require C, don’t go there. It’s tough and if are easily shaken, you will regret it.

1 Like

It is a challenging language and in my opinion, if you can grasp it, most others would seem like ‘a walk in the park’ by comparison.

True, but you can run into some issues during the transition. For instance, I’ve been doing CS50, I’m now in week 6 (the week in Python, after 5 weeks in C) and, even though I already had some basic knowledge of Python before taking CS50, it’s been pretty confusing to transition from C’s static typing to Python’s dynamic typing. I find static typing adds more clarity to your code, while in Python it’s sometimes a bit confusing to know the type of a variable because it’s less explicit.

But, overall, I’d say learning C dramatically improved my skills (even if I still consider myself a beginner). Putting aside the confusing aspect of dynamic typing, I can now code much more easily in Python than I did before learning C. Because in C there’s no magic, you have to understand everything you’re doing and that knowledge transfers to other languages.

I’m sure there are many great programmers (especially in web development) who have never touched C, so it’s probably not an absolute necessity, but I’d say learning it definitely improves your programming skills, whatever language you choose after that.

1 Like