C Language Notes
1. Introduction to C:
- Developed by Dennis Ritchie in 1972 at Bell Labs.
- Procedural, general-purpose programming language.
- Basis for many modern languages (C++, Java, Python).
- Used in system programming, embedded systems, OS development.
2. Features:
- Fast & efficient
- Portable
- Structured
- Low-level access via pointers
- Only 32 keywords
3. Basic Structure:
#include
int main() {
printf("Hello, World!");
return 0;
}
4. Data Types:
- int, float, char, double, void
- Constants using 'const'
5. Operators:
- Arithmetic: + - * / %
- Relational: == != < > <= >=
- Logical: && || !
- Assignment: = += -= *= /=
6. Control Statements:
- if, else, switch
- Loops: for, while, do-while
- break, continue, goto
7. Functions:
- Declaration, definition, and calling
- Return types and parameters
8. Arrays & Strings:
- 1D, 2D arrays
- String handling with string.h functions
9. Pointers & Memory:
- Pointer basics & arithmetic
- Dynamic memory allocation (malloc, calloc, free)
10. Structures:
- Defining, accessing, array of structures
11. File Handling:
- fopen, fclose, fprintf, fscanf
12. Practice Projects:
- Calculator
- Student database
- Tic-Tac-Toe