Why do we use C?

Rumman Ansari   Software Engineer   2023-01-14   14621 Share
☰ Table of Contents

Table of Content:


C has been used successfully for every type of programming problem imaginable from operating systems to spreadsheets to expert systems - and efficient compilers  are available for machines ranging in power from the  Apple  Macintosh to the  Cray supercomputers. The largest measure of C's success seems to be based on purely practical considerations:

  1. The portability of the compiler;
  2. The standard library concept;
  3. A powerful and varied repertoire of operators;
  4. An elegant syntax;
  5. Ready access to the hardware when needed;
  6. and the ease with which applications can be optimised by hand-coding isolated procedures

C is often called a "Middle Level" programming language. This is not a reflection on its lack of programming power but more a reflection on its capability to access the system's low-level functions. Most high-level languages (e.g. Fortran) provides everything the programmer might want to do already built into the language. A low-level language (e.g.  assembler) provides nothing other than access to the machines basic instruction set. A middle-level language, such as C, probably doesn't supply all the constructs found in high-languages - but it provides you with all the building blocks that you will need to produce the results you want!


Another Points

C is a very powerful and widely used language. It is used in many scientific programming situations. It forms (or is the basis for) the core of the modern languages Java and C++. It allows you access to the bare bones of your computer.

Yet, with great power comes great responsibility. C will not coddle you (okay, raise your hand if you think Matlab was coddling... well compared to C it was very generous to you). C will require your syntax to be even more perfect than Matlab. C will make you define every variable with a Type, and not let you ever change these (in a given program). C will assume you are a master of everything you do.

Further, C is a very basic language. There are no frills, no GUIs, no Matrix processing abilities, very little file I/O support, etc. (Note: to be honest, all of these things have been written in C and are available as libraries, but the core C language is in some sense, bare boned.)

Then,why do we use C?

  1. It was (and still is in some circumstances) the language of choice in Operating System Development (including all of Unix).

  2. It allows you direct control over the very low level aspects of the computer.

  3. Many legacy programs are written in C.

  4. Most of the things you learn with C will be directly transferable to future programming languages.

  5. Programs that are created with C run very quickly.

  6. C has a syntax (and some semantics) very close to Matlab, making the transition easy (okay, easier...).

  7. The programs you create in C will run "standalone". All of the programs we wrote in Matlab, need Matlab in order to work, and if you don't have access to Matlab, you are out of luck. C programs, once compiled into "executables", can be transferred to other (similar) machines, and run without the need for the source code.

  8. Many of the codes you will use in your future work/studies will have been written in C. You should at the least, be able to read them. And hopefully, you will be able to maintain, modify, and update them.