Complete C Programming Reference
C Programming Complete Notes
C Language — Developed by Dennis Ritchie in 1972 at Bell Laboratories. Often called the "mother of all programming languages."
01. C Language Basics
C is a general-purpose, procedural programming language that provides low-level memory access with a simple syntax. It forms the foundation of many modern languages including C++, Java, and Python.
Why C Matters? Every major operating system (Windows, Linux, macOS) has significant portions written in C. It gives you complete control over system resources.
Basic Structure of a C Program
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
Program Explanation:
#include <stdio.h> - Header file for input/output functions
int main() - Main function where program execution begins
printf() - Function to display output
return 0; - Indicates successful program execution
02. C Keywords (32 Total)
| Keyword | Description |
| auto | Declares automatic (local) variable |
| break | Exits a loop or switch |
| case | Defines a block in switch-case |
| char | Character data type |
| const | Declares constant value |
| continue | Skips current iteration in loop |
| default | Defines default case in switch |
| do | Starts a do-while loop |
| double | Double-precision float |
| else | Alternate block in if-else |
| enum | Declares enumerated type |
| extern | Declares external variable or function |
| float | Floating-point variable |
| for | Starts a for loop |
| goto | Jumps to a label |
| if | Conditional branching |
| int | Declares integer variable |
| long | Declares long integer |
| register | Declares register variable |
| return | Returns from a function |
| short | Declares short integer |
| signed | Signed data type modifier |
| sizeof | Returns size of data type |
| static | Static storage class |
| struct | Declares structure |
| switch | Switch-case control |
| typedef | Defines new type name |
| union | Declares union |
| unsigned | Unsigned data type modifier |
| void | Declares empty return type |
| volatile | Tells compiler not to optimize |
| while | Starts a while loop |
Note: All keywords are reserved words in C. You cannot use them as variable names or identifiers.
03. Data Types
| Data Type | Description | Size (bytes) |
| int | Integer | 4 |
| char | Character | 1 |
| float | Floating point | 4 |
| double | Double-precision float | 8 |
| void | No value | - |
| short | Short integer | 2 |
| long | Long integer | 4 or 8 |
| signed | Signed type | - |
| unsigned | Unsigned type | - |
// Example of different data types
int age = 25;
float price = 99.99;
char grade = 'A';
double pi = 3.14159265359;
04. Operators
| Operator Type | Symbols |
| Arithmetic | + - * / % |
| Relational | == != > < >= <= |
| Logical | && || ! |
| Assignment | = += -= *= /= %= |
| Bitwise | & | ^ ~ << >> |
| Increment/Decrement | ++ -- |
| Conditional | ? : |
| Comma | , |
| Sizeof | sizeof() |
| Pointer | * & |
| Member Access | . -> |
Arithmetic
Basic math operations: + - * / %
Relational
Comparisons: == != < > <= >=
Logical
Boolean logic: && (AND), || (OR), ! (NOT)
05. Escape Sequences
| Escape Code | Meaning |
| \n | Newline |
| \t | Tab |
| \\ | Backslash (\) |
| \" | Double quote (") |
| \' | Single quote (') |
| \r | Carriage return |
| \b | Backspace |
| \f | Form feed |
| \a | Alert (beep) |
| \v | Vertical tab |
| \0 | Null character |
// Escape sequence example
printf("Hello\nWorld\tTabbed\n");
printf("Path: C:\\Program Files\\\n");
printf("She said, \"Hello!\"");
06. Special Symbols
| Symbol | Purpose |
| ; | Statement terminator |
| { } | Block start and end |
| ( ) | Function and condition grouping |
| [ ] | Array subscript |
| # | Preprocessor directive |
| * | Pointer, multiplication |
| & | Address of operator |
| -> | Access struct member via pointer |
| . | Access struct member |
Pro Tips:
- Always initialize variables before use
- Use meaningful variable names
- Comment your code for clarity
- Check array bounds to avoid buffer overflow
- Free dynamically allocated memory
Back to Notes Page