Welcome & Hello World

🔵 C Programming Lesson 1 Beginner

C is a powerful, general-purpose programming language developed by Dennis Ritchie at Bell Labs in 1972. It is highly valued for its performance, direct hardware interaction, and serves as the foundation for modern operating systems (Linux, macOS, Windows) and compilation frameworks.

1 How C Compiles & Runs

C is a **compiled** language. Unlike Python or Java which run inside interpreters or virtual environments, your C source code is compiled directly into raw machine instructions for execution:

The Compilation Pipeline:

  • Preprocessor: Parses directives starting with `#` (e.g. `#include`), substituting macro macros and source expansions.
  • Compiler: Translates clean C source files into assembly listings.
  • Assembler: Translates assembly listings into relocatable object files (`.obj` or `.o`).
  • Linker: Combines object files and systems libraries into a single final executable binary (`.exe` or run format).
2 Your First C Program

Let's analyze a standard C Hello World template. Write and compile this in the editor:

C — Hello World ▶ Run Code
#include <stdio.h>

int main() {
    printf("Hello, World!\n");
    printf("Welcome to Our C Compiler!\n");
    return 0;
}

Let's break down the directives and statements:

  • #include <stdio.h>: A preprocessor directive instructing C to include standard input-output header declarations containing function definitions like `printf()`.
  • int main(): The entry function signature of every executable C program. The operating system looks for this to start execution.
  • printf(): Built-in library function used to print formatted text outputs to the console.
  • \n: Newline escape sequence that shifts the cursor down to the next row.
  • return 0: Returns control to the operating system. Returning `0` signals successful, error-free program execution.
3 Code Challenge
Challenge: Edit the code in the editor above. Add a third statement printing out your name, and utilize a tab escape sequence (`\t`) before printing it. Compile and execute to check the output.