5. Writing a Program in C (Lesson)

Writing a Program in C

In this module, we move from the basics to actually compiling and running our first complex programs.

Steps to Run a C Program

  1. Writing: Use a text editor (VS Code, Vim, etc.)
  2. Preprocessing: Handled by the compiler (expanding headers).
  3. Compilation: Converting C code to Assembly.
  4. Assembly: Converting Assembly to Machine Code.
  5. Linking: Combining libraries.

Example: User Input

#include <stdio.h>

int main() {
    int age;
    printf("Enter your age: ");
    scanf("%d", &age);
    printf("You are %d years old.\n", age);
    return 0;
}

Check the Lecture Slides tab to see the visual presentation for these steps.

PREVIOUS
Introduction to C Programming
FINISH
Back to Course Overview