What is C (Programming Language)? - The Basics
Before getting started with C programming, lets get familiarized with the language first.
C is a general-purpose programming language used for wide range of applications from Operating systems like Windows and iOS to software that is used for creating 3D movies.
C programming is highly efficient. That’s the main reason why it’s very popular despite being more than 40 years old.
Standard C programs are portable. The source code written in one system works in another operating system without any change.
As mentioned, it’s a good language to start learning programming. If you know C programming, you will not just understand how your program works, but will also be able to create a mental picture on how a computer works.
More information on C Language.
History of C programming
C is closely associated with Unix Operating system
Development of Unix System
The PDP-11 version of Unix system was written in assembly language. Assembly languages are low-level programming languages that are specific to a particular computer architecture. They are hard to write and understand.
The developers of Unix Operating system (including Dennis Ritchie and Stephen C. Johnson) decided to rewrite the system in B language. However, B couldn’t suffice some of the features of PDP-11, which led to the development of C.
In 1972, the development of C started on the PDP-11 Unix system. A large part of Unix was then rewritten in C. By 1973, C was powerful enough to be used in Unix Kernel. Dennis Ritchie and Stephen C. Johnson made further changes to the language for several years to make it portable in Unix Operating system.
First Book on C Programming
In 1978, the first book of C programming, The C Programming Language, was published. The first edition of the book provided programmers informal specification of the language. Written by Brian Kernighan and Dennis Ritchie, this book is popular among C programmers as "K&R".
With the rapid growth of C language for several years, it was time for language to get it standardized.
C89. The first standard of C was published by American National Standards Institute (ANSI) in 1989. This version is commonly popular as C89.
C99. In late 1990’s, several new features like inline functions, several new data types and flexible array-members were added to the C standard. This is commonly known as C99.
C11. The C11 standard has new features like type generic macros, atomic operations, anonymous structures that doesn’t exist in C99.
All these three standards are also known by the name of ANSI C.
“Standard C programs are portable”. This means, the programs that follow ANSI C standard are portable among operating systems.
If you are new to programming, it’s advisable to follow the standard (ANSI C in case of C programming) that is accepted everywhere. It will help you learn the language the way it was intended.
Features of C Programming Language
A procedural language.
In procedural languages like C, a list of predefined instructions are carried out step by step. A typical C program may contain one or more procedures (functions) to perform a task.
If you are new to programming, you might think this is the only way all programming languages work. However, there are other programming paradigms as well. One of the commonly used paradigms is Object-oriented programming (OOP) which allows developers to create objects to solve the given task. If you are interested, check out the differences between procedural and object oriented languages.
C programs are fast.
Newer languages like Python and Java offer more features (garbage collection, dynamic typing) than C programming. However, the performance lowers due to additional processing.
C language trusts programmers and allows direct manipulation of the computer hardware. This is not possible in most high-level programming languages. It’s one of the reasons why C is considered good choice to start learning programming.
Standard C programs are portable.
“Write once, compile everywhere”. Well-written standard C programs are portable, meaning, programs written in one system (e.g. Windows 7) can be compiled in another system(e.g. Mac OS) without any change.
Use of Modularity.
You can store sections of C code in the form of libraries for future use. This concept is known as modularity.
C itself can do very little on its own. The power of C language comes from its libraries. C comes with standard libraries to solve common problems. Suppose, you need to display something on the screen, you can include “stdio.h” library that allows you to use printf() function.
Statically typed language.
C is a statically typed language. This means that the type of a variable is checked during the compile time but not in the run-time. This helps in detection of errors during the software development cycle. Also, the statically typed languages are faster than dynamically typed language in general.
Despite being old, C is used in variety of applications from system programming to photo editing softwares. Some of the applications where C programming is used are as follows:
- Embedded Systems
- Operating System - Windows, Linux, OSX, Android, iOS
- Databases - PostgreSQL, Oracle, MySQL, MS SQL Server
- Other Uses - Network drivers, Compilers, Print spoolers