1. Introduction to C Programming
C is a powerful and fast programming language developed in the early 1970s. It is considered the foundation of many modern languages like C++, Java, and even Python internally.
C is widely used in operating systems, embedded systems, robotics, game engines, and performance-critical software because it gives programmers direct control over memory and hardware.
Learning C helps you understand how computers actually work behind the scenes. It builds strong programming fundamentals that make learning other languages much easier later.
2. Basic Structure of a C Program
Every C program has a structure. The #include line is used to include libraries. The most common library is stdio.h, which allows input and output operations.
The main() function is the starting point of execution. Whatever is written inside main runs when the program starts.
printf() prints output to the screen. return 0; tells the system the program ended successfully.
3. Variables in C
Variables are used to store data in memory. In C, every variable must be declared with a data type before it is used.
This helps the computer know how much memory to allocate and what type of data will be stored.
Here, int stores whole numbers, float stores decimal values, and char stores a single character.
4. Data Types
Data types define the kind of data a variable can hold.
int → whole numbers like 10, -5
float → decimal numbers like 3.14
double → larger decimal numbers with more precision
char → single characters like 'A'
Choosing the correct data type is important for memory efficiency and accuracy.
5. Taking User Input
C allows users to enter data during program execution using scanf().
We must use format specifiers like %d for integers and %f for floats.
The & symbol means “address of” the variable.
6. Conditions (Decision Making)
Conditions allow programs to make decisions based on comparisons.
C uses if, else if, and else statements.
7. Loops
Loops repeat code multiple times, saving effort and reducing duplication.
for loop is used when the number of repetitions is known.
8. Functions
Functions are reusable blocks of code. They help break programs into smaller, manageable parts.
9. Arrays
Arrays store multiple values of the same data type in one variable.
10. Pointers
Pointers store memory addresses instead of direct values. They are powerful and used for dynamic memory, arrays, and advanced programming.