Introduction to C Language
C is a general-purpose, procedural programming language developed in
the early 1970s by Dennis Ritchie at Bell Labs. It is often called the 'mother
of all modern programming languages' because many popular languages
such as C++, Java, and Python are based on its concepts.
History of C
The C language was developed as an evolution of earlier languages like B
and BCPL. It was created to build the UNIX operating system. Over time, it
became popular for its simplicity, efficiency, and portability.
Features of C
• Simple and efficient
• Structured programming language
• Portable and machine-independent
• Rich set of built-in operators
• Low-level access through pointers
• Fast execution speed
Structure of a C Program
A typical C program includes the following sections:
1. Preprocessor directives
2. Global declarations
3. main() function
4. Statements and functions
Compilation Process
The steps to execute a C program are:
1. Writing the code
2. Compiling the code
3. Linking
4. Loading
5. Execution
Example 1: Hello World Program
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
Output:
Hello, World!
Example 2: Addition of Two Numbers
#include <stdio.h>
int main() {
int a, b, sum;
a = 10;
b = 20;
sum = a + b;
printf("Sum = %d", sum);
return 0;
}
Output:
Sum = 30
Uses of C Language
• System programming
• Game development
• Embedded systems
• Operating systems
• Compiler design
• Database systems
Conclusion
C language is a foundation for many modern programming languages. It is
efficient, portable, and powerful, making it ideal for both beginners and
professionals.