1. C Language Intro, Compilation, Variables & Data Types

Comprehensive Guide: C compilation pipeline, main function, variables, data types, format specifiers & escape sequences

Module 1: C Language Overview & Compilation Pipeline

C is a middle-level, procedural programming language developed by Dennis Ritchie at Bell Labs in 1972.

🇬🇧 English Definition

C is a structured, statically typed procedural programming language that serves as the foundation for modern operating systems, compilers, and embedded software.

🇮🇳 Hinglish Definition

C language sabhi modern programming languages ki mata (mother language) hai. Ye Operating Systems, Compilers aur hardware-level coding karne ke liye use hoti hai.

Core Concepts & Rules

  • Compilation Steps: Source Code (.c) -> Preprocessor -> Compiler (.s) -> Assembler (.o) -> Linker -> Executable (.exe).
  • Portable & Fast: Direct execution close to hardware memory.
  • Block-structured language using curly braces { } for scope definition.

🔍 Line-by-Line Code Breakdown

  1. Line 1: // C Header Inclusion: stdio.h provides printf() and scanf() standard functions.
  2. Line 3: int main(): The main entry point function where C execution starts.
  3. Line 4: printf(...): Standard library output function printing string to console.
  4. Line 5: return 0;: Returns exit status 0 to OS indicating clean execution.
💻 Practical C Code Example - C Language Overview & Compilation Pipeline
// C Basics Demo by Instructor
// stdio.h header included for IO
int main() {
    printf("Hello, C Programming World by Instructor!\n");
    return 0;
}
📤 Compiled Program Output:
Hello, C Programming World by Instructor!

Module 2: C Variables, Data Types & Format Specifiers

Storing numeric, character, and floating-point data in C memory allocation slots.

🇬🇧 English Definition

Variables are named locations in computer memory that hold data values of specific types (int, float, char, double).

🇮🇳 Hinglish Definition

Variable RAM memory me data store karne ka ek dibba (container) hota hai jiska ek type aur unique naam hota hai.

Core Concepts & Rules

  • Primitive Data Types: int (4 bytes), float (4 bytes), double (8 bytes), char (1 byte).
  • Format Specifiers: %d (int), %f (float), %lf (double), %c (char), %s (string).
  • Escape Sequences: \n (Newline), \t (Tab Space), \\ (Backslash).

🔍 Line-by-Line Code Breakdown

  1. Line 2-4: Declare int age=25, float mark=95.5, char grade='A'.
  2. Line 5: printf using %d specifier to print integer age.
  3. Line 6: printf using %.1f specifier to print float mark formatted to 1 decimal place.
  4. Line 7: printf using %c specifier to print character grade.
💻 Practical C Code Example - C Variables, Data Types & Format Specifiers
int main() {
    int age = 25;
    float marks = 95.5f;
    char grade = 'A';

    printf("Age: %d years\n", age);
    printf("Marks: %.1f\n", marks);
    printf("Grade: %c\n", grade);
    return 0;
}
📤 Compiled Program Output:
Age: 25 years Marks: 95.5 Grade: A