Quick Revision of C Programming
1. Basics of C
C is a procedural, compiled language developed by Dennis Ritchie.
Basic structure:
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
2. Data Types
Basic: int, float, char, double
Derived: array, pointer, structure, union
Qualifiers: signed, unsigned, long, short
3. Operators
Arithmetic: +, -, *, /, %
Relational: ==, !=, >, <, >=, <=
Logical: &&, ||, !
Bitwise: &, |, ^, ~, <<, >>
Assignment: =, +=, -=, etc.
4. Control Statements
Conditional: if, else, switch
Loops: for, while, do-while
Jump: break, continue, goto, return
5. Functions
Declaration: return_type function_name(parameters);
Call by Value vs Reference
Recursion: function calls itself
6. Arrays and Strings
Array: int a[10];
String: char name[20];
Functions: strcpy, strlen, strcmp
7. Pointers
Declaration: int *ptr;
Pointer Arithmetic: ptr++, ptr--
Pointer to Array, Function, Structure
8. Structures and Unions
Structure: struct student { int id; char name[20]; };
Union shares memory among members.
9. File Handling
Functions: fopen, fclose, fprintf, fscanf, fgets, fputs
Modes: r, w, a, rb, wb
10. Preprocessors
Directives: #include, #define, #ifdef, #ifndef