Technical Training
C TutorialsTable of Contents
C Programming - An Overview
C Programming - An Overview - Page 2
C Programming - An Overview - Page 3
C Programming - An Overview - Page 4
C Programming - An Overview - Page 5C Programming - An Overview
This tutorial will give you an overview of the C programming language. We will cover some of the history of C, why people use it, where it is being used, and the basic structure of programs in C.
History
The C language was developed at AT&T Bell Labs in the early 1970s by Dennis Ritchie. It was based on an earlier Bell Labs language "B" which itself was based on the BCPL language. Since early on, C has been used with the Unix operating system, but it is not bound to any particular O/S or hardware.
C has gone through some revisions since its introduction. The American National Standards Institute developed the first standardized specification for the language in 1989, commonly referred to as C89. Before that, the only specification was an informal one from the book "The C Programming Language" by Brian Kernighan and Dennis Ritchie.
The next major revision was published in 1999. This revision introduced some new features, data types and some other changes. This is referred to as the C99 standard.
Advantages
Here are some advantages of programming in C:
- C is a general purpose programming language, meaning that it is not limited to any one specific kind of programming. This is different from languages like COBOL which was built for business applications, and FORTRAN for scientific calculations. You can write all sorts of software using C. .
- C is not a very high-level language. A high-level language tries to isolate the programmer from the hardware as much as possible. In contrast, C allows you to directly access memory addresses, create bit fields and structures and map them to memory, perform bitwise operations and so on. C facilitates hardware programming. .
- Not being high-level also means there is little overhead; it is highly efficient and provides fast execution speed. .
- There are C language compilers and development tools available for many different platforms from small embedded systems to large mainframes and supercomputers. .
- C has been around for almost 40 years. In that time there has much software written in C. If there is some functionality you need in a C program you are writing, chances are someone has already written it. It may even be available for free.
Uses of C
In spite of its age, C is still being heavily used in industry. Several surveys have placed C as one of the most popular languages currently in use.
C is a very good choice for writing software to control hardware. The Unix (and derivatives) operating system's kernel is written in C (with some small pieces in assembly). Most firmware and device drivers are written in C as well.
C is also used in many real-time systems programming. While the language itself does not have any real-time features, it can be combined with platform-specific libraries or libraries that implement the POSIX real-time interfaces. C is a very efficient language that does not require many supporting libraries to run and does not have much overhead, which is desirable in low-memory embedded systems. Combining real-time libraries with C give it the timing constraints and other features needed for real-time programming.
Because C is efficient and fast it is sometimes used as the development language of other programming languages. Languages like PHP and Perl have been written in C. Many computationally intensive libraries and applications like MATLAB have been written in it too, for the same reason.
We have only talked about a few specialized domains where C is used. In addition to those, there are many other applications of all kinds that are written in C.
Structure of C Program
In this section we will take a look at the structure of a C program. Remember that many of the concepts, terms and syntax shown in this section will be reviewed in detail in other tutorials. This is only an introduction.
A C program may be made up of one or more files called "source files". There is a kind of source file that is used to define constants, macros, function prototypes, type definitions, etc. called a "header file". Header files are basically used to share things between other source files. By convention, source file names have the extension ".c" and header file names have the extension ".h".
How you enter a C statements into one or more files, how you run the compiler on those files, and how you run the resulting executable is completely dependent on what system you are using and what tools you have. Most systems have some kind of text editor for creating and modifying files.
Each compiler is different, you must consult your compiler's documentation for information on how to run it and how to set different options. There are also Integrated Development Environments (IDEs) that let you edit, compile, run and sometimes debug a program, all with a friendly user interface. The examples in this tutorial were written using a text editor on a Linux system and compiled with the gcc compiler.
C Tutorials
- C Programming - An Overview
- C Programming - Data Types : Part 1
- C Programming - Data Types : Part 2
- C Programming - Constants and Identifiers
- C Programming - Operators
- C Programming - Expressions
- C Programming - Managing Input and Output Operations
- C Programming - Decision Making - Branching
- C Programming - Decision Making - Looping
- C Programming - Arrays
- C Programming - Handling of Character String
- C Programming - Functions (Part-I)
- C Programming - Functions (Part-II)
- C Programming - Structures and Unions
- C Programming - Pointers
- C Programming - Dynamic Memory allocation
- C Programming - Linked Lists
- C Doubly Linked Lists
- C Circular Linked Lists
- C Programming - File management in C
- C Language - The Preprocessor
- Call by Value and Call by Reference
- Concept of Pixel in C Graphics
- TSR in C - An Introduction







