Home »
C programming language
C language - History, Popularity reasons, Characteristics, Basic structure etc
By Mansha Lamba Last updated : November 25, 2023
Introduction
To get started with any language beginners ought to know about the history of that programming language i.e. One needs to have an insight into the timeline of a programming language like how that language emerged from non-popular language to all-purpose language. In this article, I will give readers a glimpse of the timeline of C language followed by characteristics and the basic structure of the C language program. I will clearly mention What Makes C Language Different & Superior to other languages. This article is not only for C language beginners but it is excellent for people entering programming world.
C Language History
- CPL stands for Common Programming Language. Developed by Martin Richard in the University of Cambridge in the early 1960s.
- BCPL stands for Basic Combined Programming Language. Extension of CPL. Developed by Martin Richard in the University of Cambridge in 1969. It allows the direct access of memory.
- B language was developed by Ken Thompson and Dennis Ritchie in 1969.
- C language was developed by Dennis Ritchie in 1972 at Bell Laboratories in the USA. The main aim of Dennis Ritchie to create C language is to develop a programming language to create a UNIX operating system.
ANSI C
ANSI stands for American National Standard Institute.
After 1972, different companies created their own version of C language so then there was a need to standardize the frame of C language, for this reason, ANSI creates a committee in 1988, the C is the standardize and the name was given to it is ANSI C ( C 89).
After that came, C 90 = C 89 + some new libraries + some keywords as like const, volatile, sign etc, and C 99 = C 90 + some new features.
Reasons Behind Popularity of C Language
- Simple, reliable and easy to use.
- Portability of compiled code.
- Standard library concept ( system defined function, library function).
- Ready to access the hardware whenever it is required.
- Basic of every programming language like C++ or Java.
- Speed is very fast.
- Generally, every OS is written in C language and if we want to extend the features of OS, then we need some device drivers and those devices drivers are also written in C language.
- Rich in operators. A total number of operators = 45, Total number of Keywords = 32.
Characteristics of C Language
- General Purpose Programming Language.
- Structured Programming Language.
- Rich in operators and data types.
- Less number of keywords or reserved keywords.
- Pointer arithmetic and manipulation.
- The user can add their own defined function into the system library.
- Compact representation of expression (combination of variables and constant).
5 Built-in Data Types
- Integer ( int )
- float
- Character ( char )
- double
- void
Structure of a C Program
Basic Structure of a C program is as follows:
/* Comments */
Preprocessor Directives
Global Declaration ;
main()
{
local declaration ;
statements ;
}
user-defined functions
1) Comments
These are optional components of any source code. These statements are used by the developer of the program or by the user, to explain the meaning of statements that are used in the program. These statements are not compiled by the compiler. Generally, comments are of two types:
- Single line comment:
//text
- Multi line comment:
/* text
more text
*/
Read more: Comment in C language
2) Preprocessor Directives
These statements start with #. This statement directs the C preprocessor directive to include header files, to define the constant or to substitute the macros. These are of four types:
-
#include:
To include header files
#include <stdio.h>
-
#define:
To declare macros
#define PI 3.14
-
#if:
Conditional Statements.
-
#log , #error:
Miscellaneous
Read more: Preprocessor directives in C
3) Global Declaration
Global variables are those variables whose value can be accessed throughout the complete program or in all functions. The declaration of a global variable is known as a global declaration. Generally, global variables are declared before the main function . The global variable does not declare in any function. These are optional statements.
4) main() function
Every Program must have one main() function. There is only one main function in the complete program. Program execution starts from the main function and also end at the main function. Main Program calls User defined function or system defined function to perform a particular task. Main should be written in the small letter and does not end with a semicolon.
5) Local Declaration
Local declaration statement includes the declaration of a variable and also include initialization of variable in any function. Unlike Global Variables scope of local variables is restricted to the function in which it is defined.
6) Statements
These are statements which are read by compiler and computer then performs the operations that are specified in statements.
7) User-Defined Functions
These are the subprogram. These are defined by the User, according to their needs. These enhance the readability and presentability & reusability of source code. These are an optional part. These function can be added to the system library for future use.
Example: A simple C program
// standard input output is a header file in C language
# include <stdio.h>
// main function
int main()
{
// printf is an inbuilt
// it will display "HEY FOLKS"
printf("HEY FOLKS\n");
return 0;
}
Output
HEY FOLKS
Now to get started with basic programming in C language I would like readers to try out some Basic drill questions. I highly recommend readers to try out them first themselves and then refer my solutions.
C basic programs
C Language Tutorial »