C Complete
C Complete
📌 1. Introduction to C
🔤 2. Basic Syntax
c
CopyEdit
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
🔠 3. Data Types
➕ 4. Operators
Arithmetic: +, -, *, /, %
Relational: ==, !=, >, <, >=, <=
Logical: &&, ||, !
Assignment: =, +=, -=, etc.
Bitwise: &, |, ^, ~, <<, >>
Increment/Decrement: ++, --
🔁 5. Control Structures
Conditional:
o if, else, else if
o switch-case
Loops:
o for, while, do-while
Jump Statements:
o break, continue, goto, return
🧠 6. Functions
c
CopyEdit
int add(int a, int b) {
return a + b;
}
Arrays:
c
CopyEdit
int arr[5] = {1, 2, 3, 4, 5};
Multidimensional Arrays:
c
CopyEdit
int matrix[3][3];
Strings:
c
CopyEdit
char str[] = "Hello";
📌 8. Pointers
c
CopyEdit
int a = 10;
int *p = &a;
* dereference operator
& address-of operator
Pointer arithmetic
NULL pointer
Pointers with arrays, functions, strings.
Pointer to pointer (int **pp)
#define constants/macros
#include header files
#ifdef, #ifndef, #endif, #undef
c
CopyEdit
#define PI 3.14
c
CopyEdit
int main(int argc, char *argv[]) { }
Enum:
c
CopyEdit
enum week {Mon, Tue, Wed};
Typedef:
c
CopyEdit
typedef int Integer;
c
CopyEdit
int fact(int n) {
if(n <= 1) return 1;
else return n * fact(n - 1);
}
c
CopyEdit
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
🚀 18. Advantages of C
Fast execution
Low-level memory manipulation
Portability
Foundation for learning other languages
⚠️ 19. Limitations
No object-oriented features
No built-in memory safety
Manual memory management