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
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.
-
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.
-
if you want to do embedded-systems programming (that is, make programs for devices).
-
if you want to work on systems like games where performance is everything.
Why not learn it?
-
Its text-handling is dangerously lame, and you can pick up the kind of habits that benefit cybercreeps more than anybody else.
-
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.
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.
Hey @Shinichi!
C Helps me lot of ways, mainly JavaScript.
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.
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.
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.
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.
Hi, @Shinichi,
Knowledge will never been to your disadvantage. Try to learn. Everyone on the forum will help you.
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.
I suppose it depends on your perspective. 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)
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?
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.
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.
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.