Introduction to C programming language

Introduction to C programming language

In 1947, three scientists at Bell Telephone Laboratories, William Shockley, Walter Brattain, und John Bardeen created the transistor. Modern computing was beginning. In 1956 at MIT the first fully transistor based computer was completed, the TX-0. In 1958 at Texas Instruments, Jack Kilby created the first integrated circuit. But even before the first integrated circuit existed, the first high level language had already been written.

In 1954 Fortran, the Formula Translator, had been written. It began as Fortran I in 1956. Fortran begot Algol 58, the Algorithmic Language, in 1958. Algol 58 begot Algol 60 in 1960. Algol 60 begot CPL, the Combined Programming Language, in 1963. CPL begot BCPL, Basic CPL, developed by Martin Richards in 1967. BCPL begot B which was written by Ken Thompson in 1970, B begot C in 1972 by Dennis Ritchie at the Bell Telephone Laboratories.

C is a general-purpose procedural, imperative computer programming language which has been closely associated with the UNIX operating system for which it was developed – since then the system and most of the programs that run it are written in C. It has since spread to many other platforms, and is now one of the most widely used programming language.

In 1978 the publication of the C Programming Language by Kernighan & Ritchie caused a revolution in the computing world. In 1983, the American National Standard Institute (ANSI) established a committee to provide a modern, comprehensive definition of C. The resulting definition, the ANSI standard, or “ANSIC”, was completed late in 1988.

Why Learn ‘C‘?

C is the most commonly used programming language for writing Operating Systems, such as Microsoft Windows, Mac OS X, and GNU/Linux. Operating Systems run directly on top of the hardware, there is no lower layer to mediate their requests. Originally, this OS software was written in the Assembly language, which results in very fast and efficient code. However, writing an OS in Assembly is a tedious process, and produces code that will only run on one CPU architecture, such as the Intel X86 or AMD64. Writing the OS in a higher level language, such as C, let programmers retarget the OS to other architectures without rewriting the entire code.

But why C and not Java or Basic or Perl? Mostly because of memory allocation. Unlike most computer languages, C allows the programmer to address memory the way he/she would use assembly language. Languages like Java and Perl shield the programmer from having to worry about memory allocation and pointers.

This is usually a good thing, It’s quite tedious to deal with memory allocation when building a high-level program like a quarterly income statement report. However, when dealing with low level code such as that part of the OS that moves the string of bytes that makes up that quarterly income report from the computer’s memory to the network card’s buffer so they can be shipped to the network printer, direct access to memory is critical-something you just can’t do with Java. C can be compiled into fast and efficient machine code.

So is it any wonder that C is such a popular language?

Like toppling dominoes, the next generation of programs follows the trend of its ancestors. Operating Systems designed in Calways have system libraries designed in C.

Those system libraries are in turn used to create higher-level libraries (like OpenGL, or GTK), and the designers of those libraries often decide to use the language the system libraries used. Application developers

use the higher-level libraries to design word processors, games, media players, etc. Many of them will choose to program in the language that higher-level library uses. And the pattern continues on and on and on…

Where ‘C’ Stands

All the programming languages can be divided into two categories:

  1. Problem Oriented Languages or High Level Languages: These languages have been designed to give a better programming efficiency i.e. faster program development. Examples of languages falling in this category are FORTRAN, BASIC, COBOL, PASCAL etc.
  2. Machine Oriented languages or Low Level Languages: These languages have been designed to give a better machine efficiency, i.e. faster program execution. Examples of languages falling in this category are Assembly language and Machine language.

‘C’ stands in between these two categories. That’s why it is often called a Middle level language, since it was designed to have both: a relatively good programming efficiency (as compared to machine oriented language) and a relatively good machine efficiency (as compared to Problem oriented language).

Characteristics of ‘C’

We briefly list some of C’s characteristics that define the language and also have lead to its popularity as a programming language. Naturally we will be studying many of these aspects throughout the course.

  • Small size
  • Extensive use of function calls
  • Loose typing-unlike PASCAL
  • Structured language
  • Low level (Bitwise) programming readily available
  • Pointer implementation-extensive use of pointers for memory, array, structures and functions. C has now become a widely used professional language for various reasons like.
  • It has high-level constructs.
  • It can handle low-level activities.
  • It produces efficient programs.
  • It can be compiled on a variety of computers.

Its main drawback is that it has poor error detection which can make it off putting to the beginner. However diligence in this matter can pay off handsomely since having learned the rules of C we can break them. Not many languages allow this. This if done properly and carefully leads to the power of C programming.

What is Ternary Operator in C programming with example

5 thoughts on “Introduction to C programming language”

Leave a Comment