C Programming Basics

Overview

C is a procedural, general-purpose programming language known for its efficiency and control.

Fundamentals

  • Variables and Data Types: int, float, char, arrays
  • Operators: Arithmetic, logical, bitwise
  • Control Flow: if-else, loops (for, while, do-while)
  • Functions: Declaration, definition, and recursion
  • Pointers: Memory addresses and pointer arithmetic

Memory Management

  • malloc and free for dynamic allocation
  • Stack vs Heap
  • Memory leaks and prevention

Common Pitfalls

  • Buffer overflows
  • Null pointer dereferences
  • Uninitialized variables