C Introduction
The C programming language is the foundation of many modern languages like C++, Java, JavaScript, Python, and many many others. The entire C language is included in the definition of C++, so learning C is an essential learning step to learn C++, so to learn C++ you must first learn C.
About C
C was developed by Dennis Ritchie in Bell labs in 1969 as an alternative for assembly language for creating operating systems, utilities, and other system-level code.
C language is a small low-level language with only 32 keywords, efficient, fast, and powerful.
If you consider layers of technology of a computer system as a stack.
- Application
- Operating system
- Firmware
- Hardware
C is commonly used to write code in all levels with most common use at the lower levels. Almost all firmware, modern operating systems, and a great deal of maintainability ware are written in C language.
Why C
Systems code written in C tends to be small and fast. Well-written C can generate an object code that is almost small and fast like an assembly language.
Code written in C is extremely portable because it is originally designed to develop operating systems.
The language itself is small and easy to learn, and it gives you such access to the machine that is a very rich and powerful language.
C is an imperative language
It means that the code describes the statements, subroutines are called functions , and arguments are always passed by value.
function(argument) {
statement;
statement;
statement;
}
C is a block-oriented structured language
That is code happened in blocks and the blocks are structured to enhance clarity, this is to improve the quality and maintainability of your code
function() {
statement
}
while(x) {
statement
}
for(x; y; z) {
statement
}
if(x) {
statement
} else {
statement
}
C is strongly typed
This means that each variable must have a type, type declaration is parsed at compile time and can not be changed during the life of the variable.
int i;
char c;
float f;
struct thing t;
The advantage of the strongly typed language is the performance is significantly improved over the similarly dynamic typed languages.
C standards
The first standard for C programming language was a book called the C programming language by Brian Kernighan and Dennis Ritchie. The book was officially known as K&R and the version of the language was documented as K&R C in 1978.
Then ANSI C in 1989/1990 which know as ANSI C (C89/C90), this version is the basis for the most of C that is used today, ANSI C introduced function prototype, pointers, and locals which are considered fundamental to the C language today.
Then C99 in 1999 which is mostly comparable to ANSI C with a few new features and new restrictions like adding C++ comment style and the ability to declare variables anywhere in the block rather than only at the top of the block.
Then C11 in 2011 added more functionality like multi-threading and anonymous structures and unions.
The standards for C language still coming until this moment to enhance the language syntax and ability.
Learn C roadmap
We will cover
- The basic syntax of the C language including the Hello world example.
- The C preprocessor and the essential part of the language.
- The data types used in C.
- The Operators provided by the C language.
- Defining Functions
- The Standard Library