C Language Notes
1. Introduction to C
C was developed by Dennis Ritchie in 1972 at Bell Labs. It is a general-purpose, structured,
mid-level programming language widely used for system programming, operating systems,
compilers, and embedded systems.
Features of C:
• Simple & efficient
• Portable (runs on different machines)
• Structured (modular programming)
• Rich library functions
• Supports both low-level (hardware) and high-level programming
2. Structure of a C Program
A basic C program has the following structure:
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
Execution Steps:
• Writing the code (.c file)
• Compilation (using a compiler like GCC)
• Linking (combines code + libraries)
• Execution (run the program)
3. Tokens in C
• Keywords – Reserved words (e.g., int, return, if)
• Identifiers – Names for variables, functions, arrays (e.g., sum, main)
• Constants – Fixed values (e.g., 10, 'A', 3.14)
• Operators – Symbols for operations (+, -, *, /, %)
• Separators – ; , {} () etc.
4. Data Types in C
Basic Data Types:
• int → Integer (2 or 4 bytes)
• float → Decimal values (4 bytes)
• double → Double precision decimal (8 bytes)
• char → Single character (1 byte)
• void → No value
Derived Data Types:
Arrays, Pointers, Functions
User-Defined Data Types:
Structures, Unions, Typedef, Enums