

Ask HN: Should I learn C? - lukeqsee

I'm a recent high school grad going into college as a comp sci major. I have 2 years experience in Python and JS.<p>Would it be worth my time to learn C (C++ possibly?)? (Or maybe you have another language that would be more profitable now.) I'm aware I will have to learn at least C for college, but is it something I should learn now?<p>I'm looking for your opinion because a lot of you have either gone through a comp sci degree or have done some programming in C.<p>Thanks HN!
======
mechanical_fish
Yes, you should learn C. And enough assembly language to understand aspects of
how C works, like what a "stack frame" is.

Now is a great time to start. Go find K&R, fire up Linux and write and compile
"hello, world". Then keep going until you experience your first segmentation
fault. ;)

(Do _not_ study C++ at this point. Study C. These things turn out to be very
very different.)

~~~
sreque
At my university we have a course that goes over all the levels of abstraction
between the hardware and systems-level UNIX programming. I never took the
class, but I followed the course book on my own and it proved to be one of the
most enlightening self-learning experiences I've had with programming. The
book is Computer Systems: A Programmer's Perspective, and I highly recommend
it.

I've found that even though I now spend most of my time programming in higher
level languages, my understanding of C and assembly, compilers and debuggers,
the virtual memory model and system memory hierarchy, and CPU architecture are
still very valuable in helping me reason about my code and how it interacts
with the rest of the system. I also still have developers at work on the C
development team occasionally come ask me code questions, and often the
answers to their questions come down to understanding one of the above better.
If you can master multiple levels of abstraction you will be a much more
effective developer.

~~~
TeHCrAzY
ISBN for anyone interested: 978-0130340740

------
RiderOfGiraffes
Absolutely, yes.

\+ From the point of view of Python or Java (say), it's close enough to
assembly language to let you understand how things might work;

\+ If you _need_ speed or control over hardware, sometimes it's your best
route to extend whatever you're working in;

\+ In many jobs you'll be the only one who has the knowledge to do unusual
things, hence you'll be more valuable;

\+ It gives you another point of view when designing systems;

\+ You say you'll need it for college - learn it now;

\+ A spread of languages is critical if you want to master programming.

You can carve out a perfectly good programming career without knowing C, but
it's always of benefit and value to get a wide range of skills. Some
recommend:

\+ Pure OOP: perhaps smalltalk or Self

\+ Pure Functional: perhaps Haskell (non-strict) or ML (strict)

\+ Pure Imperative: perhaps C

\+ Pure Logic: perhaps Prolog

Other hybrid languages are useful and perhaps more productive, but it's the
ideas that really matter while you're still learning.

~~~
xenophanes
I'm not sure about aiming for "pure" languages. Lisp is functional enough that
one can learn pure functional programming using it, if he tries. And Ruby is
OO enough that one isn't missing much, isn't it?

Nothing wrong with the pure languages as options, just I think impure
languages can fit the categories too.

~~~
adbge
I would recommend Ruby, too. Even though I don't write large programs or
webapps in Ruby, I use it to write the occasional script to glue different
things together.

I think that there's probably more (practical) benefit to be had with Ruby
than Smalltalk or Self.

------
alttab
A lot of people take the route of not learning C. If you do web development
and your team finds something hard or impossible to do, watch their reaction
when you say "I'll just write a C extension."

The stack-frame comment is spot-freaking-on. Knowing this level of detail will
make you a way better programmer in every other language because you won't
make stupid memory hogging decisions or mistakes. You also understand the
complexity of doing things one way and the tradeoffs of another.

I best learnt C by re-writing large portions of the Pintos operating system.
It's an academic OS and will be interesting to look at the source. Systems
programming is where C packs the most punch, but all of those concepts can be
re-applied in user land for some amazing effects.

~~~
pinchyfingers
I'd never heard of Pintos before. This looks like something I'd really enjoy
working on, thanks for bringing it up.

~~~
kaens
<http://www.jamesmolloy.co.uk/tutorial_html/index.html>

------
kaens
I, like many here, would strongly recommend learning C. I don't know if I'd
call it "profitable" to do so at the moment, assuming you mean profitable in
the money sense.

C is a good language to learn, and a lot of interesting, well-paying jobs use
C, and a lot of interesting open-source projects use C -- but if you just want
to make steady cash, you can do so much easier with Java or PHP.

That said, if you go about your programming self-education correctly, you
won't have a problem using Java or PHP (well, you won't have a problem in the
sense that it won't be difficult for you to design programs in those
languages).

It's good to have a handle on how the architecture of your machine works. C
gets you much closer to that, and you will learn about a lot of things that
are hidden from you in HLLs like Python, but that are still relevant to non-
trivial programs.

So yeah. Learn C if you're passionate about comp-sci, or software engineering.
If you're learning programming only for a career, it may not be as beneficial
for you. Learning C before college is definitely a good thing.

Also, if you learn C, the last chapter of SICP is much easier to do, and you
should go through SICP at some point ;)

Don't touch C++ until you need to touch C++. You'll know when that time is, if
ever.

~~~
lukeqsee
_I don't know if I'd call it "profitable" to do so at the moment, assuming you
mean profitable in the money sense._

I was meaning the in overall sense; "profitable" as in good for me. Sorry for
the misunderstanding.

~~~
kaens
Ahh, in that case learning C is a veritable goldmine!

Edit: Also, if you use linux and end up going down the rabbit hole a bit, C is
a prerequisite.

~~~
zavulon
Being good at C can be very profitable in a money sense of the word too.
Bloomberg is one example that hires a lot of C hackers and pays them obscure
amounts of money (very very long hours though)

~~~
dschobel
Obscure amounts of money?

~~~
Mentat_Enki
malapropism... think he meant 'obscene'.

------
strlen
Yes! In general, when asked "should I learn X | X is something that gives you
a different perspective" the answer should be yes. In particular, C is
excellent as it teaches you things must be understood even if you work with
higher level languages: dealing with pointers, dealing with raw memory
(allocation, deallocation, finding leaks), dealing with the I/O and VM sub
systems of your operating system, understanding abstract data types.

On the educational side, you will learn about hardware works. Some will argue
that there are better languages to learn these things and I'll agree: Forth
could be better for learning about raw memory addresses and systems
programming. Scheme could better for learning about data abstraction. However,
C has several salient things going for it: C is UNIX (for good or bad,
majority of serious non-embedded -- and even great deal of embedded --
programming outside of Microsoft or of Windows Desktop Application development
targets UNIX) and C is the lingua franca of programming languages.

From the practical side, you will have an advantage too. Higher level
languages generally still have pointers (Quiz: is Java pass by value or pass
by reference? Answer: It's pass by value, just the value of anything other
than the primitive types is a pointer). Higher level languages have built
abstractions around I/O and VM but they typically fall under two categories:
thin wrappers around C and POSIX APIS (Perl, Python, Ruby) or leaky
abstractions that occasionally force you to use FFI to C (JVM based
languages). In either case, if you are able to program C you have a
competitive advantage against coders brought up purely on those languages.

C is also a good language to learn about data structures: partly because
learning data structures in C is _really_ about the data structures, abstract
data types and algorithms and _not_ (as C++ and Java centric courses often
make it out to be) about OO. This is the book I recommend for data structures
in C: [http://www.amazon.com/Data-Structures-Pseudocode-
Approach-C/...](http://www.amazon.com/Data-Structures-Pseudocode-
Approach-C/dp/0534951236) (I'm biased as I learned from it myself and have had
classes taught by Professor Forouzan).

Note, I never said anything about performance. Just like it's nearly
impossible to hand-write assembly that beats "gcc -O3" (not to say "gcc -O4"
or icc) performance wise on modern hardware (out of order execution, NUMA,
specialized instruction sets), I am pretty confident that languages will
emerge that will beat C even for things like inner numeric loops by being able
to reason more about mutability, side effects or lack thereof, exploiting
parallelism and caching available in hardware. You won't be writing in C to
make computation faster, you'll be writing in C to deal with I/O, memory and
the like more efficiently: many times that will mean your code will run
faster, but it won't specifically due to being written in C (to be blunt, it
will be due to implements of runtimes and programming languages sheltering the
languages/runtimes from the hardware/OS; that may not always be the wrong
thing to do). See <http://pl.atyp.us/wordpress/?p=2947> for a great discussion
on this.

Finally in terms of C++: don't study it _before_ knowing C _and_ a non-C++
object oriented language. I was lucky enough to learn C before learning C++,
but it _was_ the first object oriented language I tried to learn. Because of
that, I thought of OO as a black art. Oddly enough I truly learned about OO in
Perl: I was writing Perl 5 (loosely adhering to Damian Conway's "Perl Best
Practices") and despite OO in Perl being an ugly hack (it's similar to
Python's, but without even the syntactic sugar that hides __dict__ away) the
Perl code I was writing was far more OO than any C++ I wrote up until then. I
then learned Python and Java; when I came back to writing C++, I was much
better at it. Josh Bloch (along with Doug Lea, the author of Java's
collections) in "Coders at Work" spoke of a similar experience (in his case,
he didn't do any OO programming before Java) and likewise speaks very
favourably about C.

I strongly recommend you do the same: learn C and do a non-trivial project in
it (writing a compiler for subset of C in C did the trick for me) to truly
grok it; continue building projects in Python (or another OO language e.g.,
Ruby, Java, Scala, Smalltalk, ObjC, Common Lisp+CLOS; pick as many of these as
you'd like) to make sure you have a firm grasp of OO _before_ you go after
C++.

------
dedward
You should absolutely learn C - you don't need to be an expert, but you should
fully grasp the use of pointers and memory allocation, and how the compiler
really works (intermediate stages and all that).

This, for the same reason you should learn some provisional level of assembler
on an older 8 or 16 bit processor with a simple instruction set (intel 8080 or
8086, and then maybe something RISC just for kicks). You don't need to be an
expert, just dabble enough that you "get" how it works.

Also learn how to implemenet a few other progrmaming patterns in C - you can
do OO in C, you can do functional in C, you can do concurrent in C. You likely
won't have to in real life, but understanding those concepts at the level of C
will really help you understand the benefits of higher level languages.

I'd say the same for any of the Lisps - learn one, even if you'll never use it
- the insights it gives you are worth it and will make your other code better.

~~~
chronomex
I wouldn't recommend learning assembly on the 8080 or 8086. These systems are
register-poor, which makes programming on them frustrating. Instead, try ARM
or perhaps MIPS. If you learn ARM, you'll probably end up programming at a
higher level on it in the future.

On second thought, learn assembly language for a platform you can run it on.
If you only have x86, learn 8086.

------
yason
You won't learn anything unless you need it, and it depends on your interests
whether you need C in your programmings.

Other than that, I can't speak for anyone but myself.

For me, C has taught me so much since I was 14 that I couldn't possibly be
where I am if I hadn't spent years writing C and I couldn't possibly recommend
anyone not to learn it. But it's a different world for everyone and I can't
say it's a bad thing if you don't know C. It would be a bad thing in my line
of business but not everyone does the same things I do.

One thing about C is that it's a nice forced marriage with the von Neumann
machines we're using these days. If you really want to know C, you really want
to know the current hardware architecture as well. It will change but it won't
do that at least in the next couple of decades.

On the other hand, mastering high-level languages first and dropping down when
necessary might be a wise choice, if you only know you can do it. Like I said,
architectures and paradigms will change in the future, and higher-level
languages can embody abstractions that are very hard if impossible to contain
in a von Neumann machine and it is the revolution of some new architecture
when C will eventually be obsoleted.

~~~
barrkel
An irony is that von Neumann architecture - specifically, code and data in the
same memory space - is not modeled by the C language in its most
distinguishing sense, and would arguably be better modeled by a language with
first class functions. First class functions - the notion of creating new
code, and passing it around as if it were data - capture this essence, that
the data and code lie in the same memory space, and that both are potentially
mutable.

------
forkandwait
I would suggest Python and C, in that order. Python will let you quickly have
fun building large applications, and it will teach you object oriented
programming. Once you know what a loop is, though, go by "Advanced Programming
in the Unix Environment" and a decent C book and trip out on that for a year
or so to really understand how computers work.

I don't write C for a living at all, but it is great to know how everything is
working under the hood, and APUE will teach you that.

To be honest, I wouldn't bother with Java. I think in ten years Java will look
like Ada does now: we will all be asking ourselves "What were we thinking?"

I also wouldn't bother working on anything but Unix, but that is just bias...

~~~
johnwatson11218
I just checked Amazon for that book and it looks like you can get used copies
of the first edition for under a buck.

[http://www.amazon.com/gp/offer-
listing/0201563177/ref=dp_olp...](http://www.amazon.com/gp/offer-
listing/0201563177/ref=dp_olp_used?ie=UTF8&condition=used)

~~~
silentbicycle
True, but the Unix world has changed quite a bit since then...there was this
thing called "Linux", maybe you've heard of it?

1st ed. APUE won't cover e.g. epoll/kqueue at all. Get the 2nd. _Fantastic_
book, though.

------
Figs
You should learn C and Java. These languages seem to be the most commonly used
in college classes right now, and if you are already fluent in them, you can
focus on the actual lessons much more easily, rather than wasting time with
the nuances of the programming languages.

Of course, it will also help if you start working on the following things, as
they will show up in your classes. Don't worry if you don't understand it all
right away, that's why you're going to college, right? :)

\- How to debug (go read the book by Agans if you haven't already. It's short
and fun to read.)

\- How to do base conversions (eg. how do you convert decimal numbers to
binary? decimal to hexadecimal?)

\- How to work with sets (If you know how to work with list comprehensions or
the set objects in python, or have played with SQL, that's quite handy)

\- How to write a proof. (Here are some handy words to google for: "modus
ponens", "modus tolens", "propositional logic", "truth table", "logical
fallacies" and, once you get a feel for propositional logic, go look for
"first order logic".)

\- How a computer works at the level of logic gates. (Go play with the java
applet "xLogicCircuits": <http://math.hws.edu/TMCM/java/xLogicCircuits/> and
see if you can figure out how to design a CPU. It can be pretty fun, although
the applet's a little clunky.)

\- What state machines are, and how they relate to regular expressions.

\- While you're learning C, go look at assembly languages and see if you can
understand the relation between C and assembly, and also between assembly and
logic circuits.

\- How to study and manage your time (Yeah, I'm still working on that one
myself...) :)

------
TallGuyShort
Even though C is used more and more rarely outside of systems programming, I
definitely recommend learning it. Learning about pointer arithmetic, memory
management, etc... will give you a depth of understanding in other programming
languages that other students will be sorely lacking the first few years of
college. Other than a little OS-hacking on the side, I've never used it for a
project, but understanding how C works has helped me debug much more
effectively in several other languages.

~~~
jolan
It's also very useful for extending other languages by binding a library.

~~~
pgbovine
agreed ... since you seem to be proficient in Python, one potential exercise
is to write a C extension to the Python interpreter or C library modules for
high performance

~~~
benofsky
This also has the extended benefit of learning more about how Python is
implemented, which always helps!

------
j_baker
My answer to the question "Should I learn <programming language x>?" is almost
always "yes". Even if you never need to use it, it's always good to have a
different way of looking at things.

One thing you might want to look at is cython[1]. It allows you to write C
extensions in a Python-like language. Could be useful as a "bridge".

[1] <http://cython.org/>

------
jpdbaugh
I really only have experience with web development with Rails and in PHP. I
also have done a little Java at school. I am considering diving into iPhone
development and learning Objective C. Would I get at least some of the
benefits of learning C that you all have described in this thread from
Objective C? From what I understand you even have to learn some raw C to work
with Objective C.

~~~
mechanical_fish
The answer is "yes, some". You will have to deal with pointers and memory
allocation, though I believe the newest ObjC runtime has a garbage collector
so your exposure might be limited... if you're lucky. ;) And you'll get a
general exposure to C syntax, the compilation cycle, et cetera.

From a strictly pedagogic perspective, it would also be good to spend some
time studying vanilla C and the POSIX APIs. When we say the phrase "learning
C" in a thread like this one, we tend to actually mean "learning to work at a
lower level of abstraction, closer to the OS, to assembly language, or even to
the hardware itself". And I believe that most of iPhone development consists
of telling Cocoa to do things, and Cocoa is presumably not a very low level
API -- thank god.

However, any C is better than no C, and iPhone development is fun and useful,
so if it inspires you, go for it.

------
JoelMcCracken
Theoretical aspects:

I assume that you want to be a good hacker. A good hacker has a healthy mix of
knowledge that will allow him to start work quickly on almost anything.
Without a solid grounding in C, (and a perspective of JS and Python), there
are a whole class of things that you won't be comfortable working with unless
you have some lower level experience.

With your current knowledge, how easy would it be for you to start hacking on
an IP stack? Not that you would ever need to, but with a good knowledge of C
such a thing becomes natural to you. All of those RFCs begin to make much more
sense.

Another big benefit to C is how simple it is. You begin to see how possible it
would be to create a simple C compiler, and this is a good spot for this
intuition. It has a simple syntax, is somewhat feature-poor, and is very close
to the hardware.

Plus, you'd be able to hack on CPython if you want ;)

Practical aspects:

Your knowledge seems to say that you are headed for web development, which I
applaud, because all things exciting are happening on the web.

Web development is changing. It used to be that web developers were laughed
at, considered to be inferior to other programmers. It has been a few years
since I've seen that opinion, and I think it has been thoroughly shown to be
wrong.

Web development has become, essentially, a two part system where the pretty
web front end sits as an interface to a super hardcore back end. Web companies
now face scaling issues that are relatively new to web development. While you
may never program in C, having a strong foundation on what the underlying
issues are.

Either way you look at it, learn C is to get a better understanding of
technology. It will certainly do that for you very well.

------
codingthewheel
Yes! Learn C!! But learn it with a view towards using it to _inform your use
of other languages_. The low-level aspects (pointers, memory management,
working with .DLL or object libraries) are things that most languages, however
fluent or high-level, use under the hood.

Spolsky and Atwood argued this out in Stackoverflow Podcast #2.
<http://blog.stackoverflow.com/2008/04/podcast-2/>

Just get a comfort level with it (C), and move on. It will pay dividends.

------
AndrejM
I've only had a few months of experience with Python, but I had no trouble
learning C (it only takes a week or two to get used to the syntax). I'm
pasting this from my reply in a Reddit thread:

If you're going to read K&R, make sure you visit the Errata page. There are a
bunch of examples that have typos (some of them are not on the Errata page
though).

But reading one C book isn't going to teach you everything about C. A lot of
the C code out there makes heavy use of macros and multiple pointer
indirections, which isn't covered in much detail in K&R. And if you're
interested in the newer C99 standard, The C Primer is a great book (but it's
quite thorough, which imo, is a good thing).

If you're going to try out the examples from K&R, pass these arguments to gcc:
-ansi -pedantic -Wall -Wextra -g

The -g flag is for debugging symbols. I think I still have most of the fixed
examples from K&R that will compile, if you're interested in these. Also, make
sure to bookmark these two links:

<http://www.eskimo.com/~scs/cclass/krnotes/top.html>

<http://users.powernet.co.uk/eton/kandr2/>

The first one gives you some better explanations of what has been said in the
K&R book (divided by chapters). The second one has most answers to the
exercises in the book.

------
rmk
NO to C++! If you want to learn something that is object-oriented, go for
Ruby... Much more accessible than C++, and also in demand.

As for C, yes, you should learn C. In several industry segments (such as
embedded systems), you cannot even get an interview if you do not know C.

A nice way to do something in C is to write a text editor using ncurses for
the GUI. This was something I did in my second year as a Comp Sci major in
school, and it was a great experience (with a friend).

------
roryokane
I think you should learn C only if you will be able to learn enough of it to
be very comfortable with it when you get to college. If you learn that much,
you can place out of the courses where you learn C. However, if you learn only
part of C and still have to take the course, you will have to suffer through
many lessons teaching you what you already know. I say this from experience –
I learned Java in high school and was taught C++ in college (just finished my
freshman year), and about half the lessons were about stuff I already know,
like the difference between a value and a reference/pointer to that value, and
what an object is, and how while loops work, and other exceedingly boring
stuff like that. So if you can’t learn C quickly enough to place out, save
yourself the trouble and just learn it in the university courses, so that the
courses will be interesting, because they are teaching you something new.

------
dgulledge
Absolutely! By learning to deal with pointer manipulation and memory
allocation, you can learn what it is, why it is necessary and how to recognize
when it is broken. One of the problems with garbage collection is that it
suffers from a memory management problem at a higher level of abstraction.
There was an entry in an autonomous vehicle competition a few years ago that
stalled. Physical objects in the environment were represented internally as
objects in the code. When the vehicle passed them, they were moved to a
collection of objects that had already been identified but were out of the
field of view. That collection grew unbounded even with garbage collection
because every one of those objects was still referenced.

------
adamtj
Yes. You won't really know python or javascript until you learn C. You may
gain some empirical knowledge about how various parts of those languages
operate, but without knowing C, you won't understand the "why". If you
understand the "why", you'll occasionally be able to intuitively see solutions
that would never have occurred to you otherwise. Those are the sorts of key
problems that can make all the difference in the success of the project and of
your career.

Any language you learn will make learning additional languages easier and
faster. But, the boost you get from learning C is arguably greater than for
other languages. It's also the single most powerful backup language you can
know.

------
msg
Here's where C is taking you.

After you understand pointers and structs and have futzed around in the Unix
command line for a while, you probably have enough to go on to something like
Linux Programming by Example. This book walks through GNU implementations of
Unix utilities and the system calls that make them possible.

You don't just want to run ls, you want to know enough that you can write ls
by yourself. You want to learn how to manipulate the operating system with it.
You will learn a mental model for how operating systems work in a deep,
detailed way, which will serve you well no matter where you go.

~~~
danieldk
Definitely, and keep W. Richard Steven's 'Advanced Programming in the UNIX
Environment' close by.

------
horofox
Yes you should! It's also important to know how basic data structures work(you
will learn it in college). I studied before college on a good book of data
structures in C which introduce from the basics(like binary numbers and so on)
that let you learn C and also improve a lot in algorithms. The book name is
"data structures using C". Here is the amazon link:

[http://www.amazon.com/Data-Structures-Using-Aaron-
Tenenbaum/...](http://www.amazon.com/Data-Structures-Using-Aaron-
Tenenbaum/dp/0131997467)

Have much success in your degree!

------
kristiandupont
Since everybody in here more or less agree, I will allow myself to counter
just a little bit.

There is no doubt that C programming is a very good skill and if you see
yourself programming a lot in the future, it is more or less a no-brainer. BUT
it is still a trade-off. It will cost you time and this is time that you could
have spent having fun, making money or learning some other skill instead. You
could ask people in any field if X-basic-skill in their field is worth
studying, and you would get similar answers.

But yeah, you should learn C :-)

------
watmough
Absolutely yes.

There's no downside in learning C, and there's not much fluff in the language
core to complicate things, or slow things down.

I'd suggest you get a copy of K&R: The C Programming Language and just work
through the text and examples. You might also want to pick an existing C-based
project and work on bugs in it, maintenance programming being one of the best
ways to get to grips with using the key tools, gcc and gdb.

This way you'll get a feel for the language, and also for what you'll need to
debug and fix code.

~~~
prodigal_erik
One downside to learning C is that you will have to resist the temptation to
use C on projects where much safer and more productive languages are feasible.
Being _able_ to use it speaks well of you, but _actually_ using it is rarely a
good decision these days.

~~~
watmough
I get your point, but there's a lot of pretty solid apps running just fine on
iOS that are primarily written in (objective-)C.

------
pan69
While you're at it you might want to pick up a copy of "Code: The Hidden
Language of Computer Hardware and Software" by Charles Petzold. One of the
most compelling and well written books on the subject I've read. Reading this
along side learning C and Assembly language will make it all "click".

[http://www.amazon.com/Code-Language-Computer-Hardware-
Softwa...](http://www.amazon.com/Code-Language-Computer-Hardware-
Software/dp/0735611319/ref=sr_1_1?s=books&ie=UTF8&qid=1279416939&sr=1-1)

------
evilthinker
Yes learn it, you should also learn at least one language per paradigm, it
will give you a wider perspective on programming and a flexible mind. IMHO one
should learn at least: Haskell(or something ML based like OCaML or F#),
C++(regardless of what anyone says it will be an useful insight), Java or
C#(also check D if you want), something Lisp based(Scheme is small and
simple), perhaps some Prolog, Erland and Ada.

Oh and see something of Forth if you like the looks of it and some assembly.

------
perlsys
It's better if you dont ask!

I don't believe that Linus ever asked (someone else) if he should learn C. Or
that Damien Katz (couchdb creator) ever asked if he should learn Erlang. Or if
Brad Fitzpatrick (Livejournal & Danga) ever asked if he should learn Perl!

Just learn what you (from looking around) believe will make you a better or
smarter, what is even more important use what you learn. Don't just learn to
learn!

~~~
lukeqsee
"A penny saved is a penny earned." Just as a minute saved is a minute gained.
I asked to save myself time. Hindsight is 20/20, and a whole lot of people on
here have hindsight.

------
marvel
There is no wasted knowledge, C is a primitive language, but could teach you
things that many other languages cannot.

Consider proper memory management, et al. There are other languages that
implement similar features that C does, but ANSI C is a macro-assembler in the
truest sense of the word.

Pick up a copy of "The C Programming Language, by Kernighan and Ritchie" and
do the exercises.

Good luck.

------
zweinz
I don't know what college you're going to, but you probably won't be able to
graduate without taking some sort of course in C. If for some reason your Comp
Sci major leaves it out, do Stanford's CS107 course:
[http://see.stanford.edu/see/courseinfo.aspx?coll=2d712634-2b...](http://see.stanford.edu/see/courseinfo.aspx?coll=2d712634-2bf1-4b55-9a3a-ca9d470755ee)

------
forgottenpaswrd
No, if you want it to be "more profitable" just spend your time learning
marketing(what the people that uses the software need) or how money works.

If you want to understand how computers work, of course you will need to know
assembler and c. This will give you the option to do things that other people
can't.

If you want short term profit, you should choose other options.

------
ecaron
No, you should learn Java instead. The leap from Python to C would be
atrocious, but the leap from Python to Java would be feasible. (And if, after
feeling comfortable with Java, the leap from Java to C becomes reasonable
too).

You'd want to learn C to get a feeling for how the computer works at the core,
but more important than that you should be seeking a rock-solid foundation in
proper coding methods and structures that has potential off-branches into your
courses and your career.

From Java, you could pursue Android development or even Objective-C for iOS
development. From C, that transition would be frustrating to say the least.

(Other points behind pursuing Java is you'd find it quicker to start testing
on your local box without needing to seek help, it'd give you great insight
into what an IDE is and why it is your best friend, and there are more
community projects surrounding Java than C that you could start to participate
in when you're ready.)

In the end, any language you want to learn would be a good language to learn
(even Fortran), but you should go after a language that you can go from 0-to-
novice on your own in a short time where you'll end having built a nice
repertoire, and I think Java would best suit that need for you.

------
gte910h
C yes, C++ no.

Make sure you're using a _C_ compiler, not a C++ compiler

Here is why not C++: <http://news.ycombinator.com/item?id=1463592> and why not
java

Edit: Was there something wrong with my comment? Or were you downvoting merely
because you disagree?

~~~
evilthinker
Those are not reason on not to use C++, but reason on why some people
shouldn't be using C++ in the first place. Yes you can do it in python unless
you want speed, if I am to interface my python code with C or C++ why can't I
write them in C++ in the first place? Also if I were to interface any
scripting language code with C I would probably go with Lua.

~~~
gte910h
I'd say "It doesn't work well in most shops" is a damn good reason to not use
something.

In general, very little of the program needs to be written in C to get great
performance gains.

Additionally, python is vastly different from LUA. Lua is still a scripting
language, ruby and python have moved past that.

For someone at age 18 or so, I'd say C is a much much better level of
complexity to be tackling that C++

------
thenduks
Personally I'd say the answer to any question that starts with "Should I
learn..." is almost _always_ __yes __.

------
Keyframe
C is lingua franca of programming languages. Even if you don't find yourself
programming with it, it will still be useful.

------
chriseidhof
Yes, learn C. I've tried to avoid it for years, but it's actually a beautiful
and simple language. It's very powerful and low-level, which means that it's
easy to create ugly programs, but that's another problem.

If you ever have to do low-level programming or Mac/iOS development it will
definitely be of great use.

------
d0m
In my opinion, instead of asking and spending time reading the comments of
everyone saying why you should learn C, you should have actually learned C.
It's a great language and learning it will surely help you in your career.

Think of it this way: Why _not_ learning it?

~~~
lukeqsee
I asked this question for two reasons:

1) I had already started learning C. It is low-level, and I was getting
disinterested. I wanted to know if it'd really be worth the work to learn it.
(The answer is absolutely.)

2) So that other people, when wondering if they should learn C, would have a
great list of hacker recommendations. (That has happened.)

~~~
ssp
If you are getting disinterested, do some project that C would be good at,
like graphics, or a hardware driver, or an OS kernel.

------
queensnake
You're going to be learning C and / or Java in your first year so, you're just
getting a bit of a leg up. If you have a strong preference for Java go for it
first, but, I'll say uselessly (cuz everyone else already has) that you'll
learn more about computers with C.

------
brianobush
Yes, it is worth learning C even though most CS programs do not use C now. C
is an excellent abstraction of the actual machine. Python is great, but many
of the constructs used in python do not map directly to the CPU. Like many
have said, C is portable assembly.

------
bleepster
C is a good starting point. Its "strengths" and "weaknesses" made me
appreciate/discover other programming languages' "strengths" and "weaknesses"
:)

------
0bfusct3
Get a hardware book and read up on how computers actually work. This will help
an immeasurable amount to understanding why C is the way it is.

------
mathgladiator
Yes, because one day you may be tempted to write a windows driver to hack
games (how I helped a friend write a WoW bot).

------
jscore
Yes, it definitely. A good way to build your fundamental knowledge of computer
science.

------
brianm
Yes.

------
unwantedLetters
Yes.

I'm sure there are many reasons to know C/Assembler. But I felt like learning
things like why:

obj.getField().setFirst("random"); obj.getField().setSecond("random");

is worse than

Field field = obj.getField(); field.setFirst("random");
field.setSecond("random");

Another reason I used to like C was that it always made me want to make my
code run as fast as it was possible to run. When I write code in Java, I'm
looking to make the code work. I'm not saying either is better, they just each
have their plus points, but I enjoyed C more due it's challenges and feel I'm
a much better programmer for knowing it.

------
jc-denton
Short answer: yes.

Long answer maybe you also want to learn some assembler to see how the machine
really work (I would recommend programming a simple microcontroller or the
lego NXT things).

If you manage to learn C. It will be easier later to learn an object oriented
language later. (Java, C# or C++)

The problem (and the frustrating thing) will be that you first probably wont
achieve much by using pure c. Therefore you can also start with toolkits like
processing.org which can teach you basics about algorithmic thinking.

------
jc-denton
Ah just saw that you did Python and JS first. So yes I suggest learning C or
C++ (maybe C first, because it's easier)

