APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

The C programming language and its importance

© September 2009 Girish Venkatachalam
Girish Venkatachalam

Girish Venkatachalam is a UNIX hacker with more than a decade of networking and crypto programming experience. His hobbies include yoga,cycling, cooking and he runs his own business. Details here:


I don't like the title of this article. I know this is not appropriate and I am not in a mood to look around or rack my brains for a fitting title. It is going to be a tough proposition since words cannot adequately express my feelings no matter what language I use.

The depth of my feelings and conviction are so strong that no language or communication medium can express my feelings in true glory. I can perhaps sing a song about it, but I am no musician.

So here we go. I shall try to explain the idea in this article. But I hope you understand that this article can only capture the spirit and not the details of my thought process.

Even that is a good thing to achieve. The C programming language after all is not for everybody. It is meant for people who need not be told about it. It is meant for people who do not need to be taught.

The C programming language is unique. It is special. It is small. It is great and it is filled with UNIX genius. It is just like a typical UNIX tool which does only one job, but does it well. The C language is small but it is the most challenging programming skill to acquire today.

I have been doing serious C programming for close to a decade now. But I feel like a child on the seashore picking up a pebble here, a pebble there when the vast ocean lies unexplored in front of me.

This was stolen from Isaac Newton. And I also wish to steal another saying of his. I have been able to do whatever programming I did using C only due to the open source C programs I have seen in different projects available in the familiar places like sourceforge and also in later days the operating system source code under /usr/src in OpenBSD.

Many people do not know that the BSD family of operating systems give you the source code for everything that goes into the OS. With Linux, there is fragmentation and there is no central repository. Anyway I digress. So I was saying that the abundance of C programs I could read and learn enabled me to say what Newton said.

If I could see farther it is only by standing on the shoulders of giants gone before me.

I taught C myself and learn the constructs and techniques, indentation styles and so on looking at the wide cornucopia of programs available for everyone to see.

People foolishly think that copying, copy pasting and learning from other people's code is wrong. You have to do it yourself. How can you get sillier than that?

Don't you know that the best way to learn is by example? And that you should always learn from the masters? The best in the field?

That being the case, you should browse C code. You should try to do something on your own and compare what you have done with the masters. That way you know where you stand and correct your thinking and coding practices.

C programming is not for everybody. I am sorry for sounding pompous but that is simply the reality. It is not meant for individuals who are not ready for the long haul. It is not meant for people who program with a view towards making money or getting a job done.

C is meant for people who understand the big picture well. It is meant for technologists, technocrats and people who create and design stuff. You have to go through the pains of C programming for at least 4 years before you can call yourself an expert. If you choose to call yourself that.

I come across many C programmers who say that they will rate their C skills as only 7 or 8 out of 10 even after programming for 5 years or more.

C is deep. C is painful, but it is fun since there is no comparison.

Most of the time, what you can do in C, you cannot do in any other language. Think of kernel programming or embedded systems.

Also I wish to point out that the efforts in learning C and the big picture are richly paid. No doubt about that. The deeper you go into technology, you want to know about memory, CPU, registers and so on. Embedded programming involves tight programming practices. You should be careful with buffer sizes, with mallocs and so on. Your brain learns to think like a genius once you do C programming for a while.

running cheetah
Stop spam dead in its tracks!

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> The C programming language and its importance


Inexpensive and informative Apple related e-books:

iOS 10: A Take Control Crash Course

Sierra: A Take Control Crash Course

Take Control of Automating Your Mac

Photos: A Take Control Crash Course

Take Control of the Mac Command Line with Terminal, Second Edition

More Articles by © Girish Venkatachalam

Related Articles

Mon Sep 28 15:21:41 2009: 6990   anonymous

I have programmed in high level languages all my life (40) and stayed clear of C up until a couple of months ago. At that time I was playing around with a gadget called a A320 dingoo which was running a linux kernel and I wanted to have a go at trying to port something to it. Once the initial shock was over (where's my strings gone!, what do you mean no classes! surely you cannot do dangerous things like that!) it was pure love. I was struck by the purity and simplicity of it. Who cares how long something takes? Would you rather spend a week on something you like or a lifetime on something you love?

Don't be afraid, dive in!

Mon Sep 28 17:25:06 2009: 6991   BigDumbDinosaur

Many computer jocks of my generation (I'm at Social Security age, in case you're wondering) first learned to program in assembly language. At the time when I first got interested in computers, John F. Kennedy was still the president of the USA, most cars had tail fins and the only high level languages in widespread use were COBOL and FORTRAN. FORTRAN was (still is) quite limiting, as it is best at numeric processing. You wouldn't write a word processor in FORTRAN but you might use the language to extrapolate the behavior of an airplane wing during transonic acceleration.

It was often derisively said that COBOL was designed so non-programmers would think they actually knew how to write computer software. There must've been a lot of non-programmers back in the heyday of the IBM S360 and its competitors, as countless lines of COBOL were written to do just about everything imaginable--poorly, in many cases. The reality was that the only way to get performance and flexibility back then was to use assembly language.

In the mid-1970s, I got my hands on a KIM-1, which was powered by a MOS 6502 processor, and discovered the joys (?) of writing 6502 assembly language programs. Assembly language and I weren't strangers, of course. In 1970, I had been involved with the ZMT project at the U.S. Post Office, an early attempt to computerize letter sorting by ZIP code (ZMT = ZIP Mail Translator). The ZMT "computer" only understood raw machine code, and me being a machine-oriented kind of guy, viewed the ZMT as a sort of kindred soul and actually took a liking to writing code for it. So working with the KIM-1, which, like the ZMT, was little more than an MPU, RAM and primitive I/O (all clocked at a screaming 1 MHz), felt perfectly natural.

At the time, I didn't know BASIC at all, and while I could read and understand a FORTRAN or COBOL program, no one would have accused me of being an expert in either of those languages. Not to worry! The KIM-1 didn't have a FORTRAN or COBOL compiler, or a BASIC interpreter (although a version of Bill Gates' interpreter was soon...er...borrowed and ported to the KIM). It didn't even come with a full-fledged assembler. If you wanted to write a program to run on the KIM, you wrote it in 6502 machine code using the built-in ROM monitor (what there was of it).

Being a very machine-oriented way to program, 6502 assembly language made perfect sense to me--just as the ZMT's machine code did. This became very apparent to me a few years when I got my hands on one of the early Commodore computers. I quickly discovered that while the built in BASIC interpreter (a Micro-Soft "product") was easy to use and, like COBOL, could make a non-programmer appear to know what s/he is doing, you couldn't write anything complicated and expect to see usable results in your lifetime. BASIC running on a one Mhz machine with string garbage collection seemingly occurring at five minute intervals was laughable. For example, I wrote a shell sort in BASIC to alphabetize a list of 1000 or so names. It took the better part of two days to produce results. So it was back to assembly language for me. I didn't touch BASIC for another decade, and that was only because I was hired to write some stuff to run on a Point 4 minicomputer.

To me, C is a high level abstraction of assembly language. C works mostly with the same kinds of objects that one might use in an assembly language program: a few data types (e.g., integers and characters) and amalgamations of those types into more complicated structures. It is this high level assembly language abstraction that makes C well-suited to writing an operating system, database engine, or similar system-type application. Most UNIX types know that a major accomplishment in the early 1970s when Ken Thompson and Dennis Ritchie rewrote UNIX in C (although not 100 percent C--some assembly language was still needed where the code was right against the bare metal). To me, that was the beginning of the end of widespread usage of assembly language, although it would persist well into the 1980s on some mainframe and super-mini installations, and even longer on micros.

Be that as it may, C is not the answer to everything. The timesharing versions of BASIC that were developed to run on 1970s-era minicomputers were (still are) much better at doing the sorts of things needed to run the average business--database management, printing invoices, generating shop orders, etc. Since C is a high level abstraction of assembly language, it tends to be weak in the same areas that assembly language is weak. For example, string handling in C is essentially like it is in assembly language. You line up a bunch of characters in contiguous memory and point at the first memory location to manipulate the string. You can't directly compare two strings; you have to call the STRCMP() function (or something similar), which essentially does what an assembly language program would do: compare the strings a character at a time and report its results as an integer. All of this is automatic in BASIC--you can say something like IF STRING1 == STRING2 and BASIC magically figures out where to find the strings and how to compare them.

However, C does a lot well and has a degree of portability that few other languages can claim. I'm sure it will be in use long after many of us are gone.

Mon Sep 28 17:33:35 2009: 6992   TonyLawrence

I can't let Steggy mention assembly without my mentioning The Zen of Assembly Language: (link)

I can't find my copy, which is a shame - look at the prices Amazon wants for used copies.

Back when I worked for Radio Shack, another guy and I would set puzzlers for each other like "Bet you can't do THIS in less than 100 instructions". Great fun.

And as Steggy notes, moving from Assembly to C wasn't all that hard, though I still made plenty of rookie mistakes!

Mon Sep 28 17:39:45 2009: 6993   TonyLawrence

Found it!

Fun to read, though it is surprising that it carries such a price, considering how out of date it is.

Some of the advice might still be valid (it's been a while since I read it, so I'm not certain of that), but surely most of it must be meaningless today?

Mon Sep 28 19:51:15 2009: 6995   DavidGerard


(I originally saw it on a Windows software site, of all places. There are also YouTube videos of it.)

When I find my code in tons of trouble,
Friends and colleagues come to me,
Speaking words of wisdom:
"Write in C."

As the deadline fast approaches,
And bugs are all that I can see,
Somewhere, someone whispers:
"Write in C."

Write in C, Write in C,
Write in C, oh, Write in C.
BASIC's dead and buried,
Write in C.

I used to write a lot of FORTRAN,
For science it worked flawlessly.
Try using it for graphics!
Write in C.

If you've just spent nearly 30 hours,
Debugging some assembly,
Soon you will be glad to
Write in C.

Write in C, Write in C,
Write in C, yeah, Write in C.
LOGO's not the answer.
Write in C.

Write in C, Write in C
Write in C, oh, Write in C.
Pascal won't quite cut it.
Write in C.

Mon Sep 28 19:51:25 2009: 6996   christophe

I agree with you on many points. But...

"With Linux, there is fragmentation and there is no central repository". Hmm ? IMHO, sources are not provided by default on a core installation only to gain _space_, but they are presents in a *very* nice way in a central repository (usually one by distribution). For instance, here is how to do on a debian system (original upstream sources are _never_ altered, everything needed to build a binary package is explicitly provided) :
cd /usr/src && apt-get source $(dpkg-query -W -f='${Package}\n')

Mon Sep 28 20:17:02 2009: 6998   TonyLawrence

I love the "Write in C" song. I hadn't seen that before, thanks!

Mon Sep 28 21:36:03 2009: 7000   BigDumbDinosaur

I love the "Write in C" song. I hadn't seen that before, thanks!

It is cute, although the line about BASIC being dead isn't true. It reminds me of someone's tag-line from www.6502.org:

Get a bit, get a byte,
Shift to the left, shift to the right.

There's more to it but my SRAM fails me. <Grin>

Mon Sep 28 22:17:00 2009: 7001   TonyLawrence

This got picked up by Linux Today and was roundly trashed in the comments there.

For crying out loud: could they give the guy a break? He said he was having trouble putting his thoughts into words.

I wish they'd just not bother, honestly. Not everyone can precisely express what they mean to every one else's satisfaction. Clear writing is HARD - personally I'd rather give people a soapbox to say what they honestly feel than to read yet another sanitized, oh so carefully vetted, committee approved, zero defect article somewhere else.

This site is for real people. I don't agree with everything Girish said here or in some of his other posts. But I *do* want to read what he has to say, even if he's struggling to say it.


Tue Sep 29 06:05:35 2009: 7004   VarrunRamani

Pardon me if i sound like a n00b(dont have as much exp as you), but what about C++? Dont you think that C++ is more powerful as it extends C as well as adds the power of the Standard Template library which makes life really simple.Well, certain code i used to write upto 20 lines in C, takes me only 2 lines in C++ with STL. So is Python, but i dont prefer python much as it is a very loosely typed language and debugging can be hell.
Just a few thoughts


Tue Sep 29 12:39:27 2009: 7007   TonyLawrence

I can't speak for Girish, but I never got into C++. I understand the appeal of OOP, but it doesn't fit with the kinds of things I do (small, ad hoc projects). Also - and I know this is silly - I just can't stand the run-on class names:

NSStringWithoutYourMothersHatButWithNiceCandyFrosting - aargh!

Wed Sep 30 12:48:15 2009: 7014   TonyLawrence

See Andrew Smallshaw's response at (link)

(It was too long to post as a comment so I gave it its own page)

Fri Oct 2 14:49:42 2009: 7043   TonyLawrence

People foolishly think that copying, copy pasting and learning from other people's code is wrong. You have to do it yourself. How can you get sillier than that?

That bothered me when I read it, because sometimes it's better NOT to use other people's code. I was looking for this article: (link)

As I said there, sometimes it is just easier to write the whole darn thing yourself, from scratch, soup to nuts, reusing nothing..

Though *learning* from op's code is of course always valuable.

Fri Jan 18 14:24:31 2013: 11755   christi


I am not a programmer but I have this C language subject this session and have to prepare for it. What all topics should be covered in it?
And has anyone studied from this course (link) of C tutorial online?? or tell me any other guidance...
would really appreciate help

Fri Jan 18 14:38:34 2013: 11757   TonyLawrence


Lots of stuff on-line. TONS of stuff.


Printer Friendly Version

Related Articles

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

Random numbers should not be generated with a method chosen at random (Donald Knuth)

Linux posts

Troubleshooting posts

This post tagged:



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode