Topic 1 of 15 · Beginner
Introduction & First Program
How C programs are compiled, linked and run.
Concept
C is a fast, compiled, low-level language used for operating systems, embedded systems and compilers. You manage memory yourself.
Building a program has four steps: preprocessing (#include, #define), compiling to assembly, assembling to object code, and linking into an executable.
Every program starts at main(). printf prints formatted output; return 0 tells the OS the program succeeded.
Code (C17)
#include <stdio.h>
int main(void) {
printf("Hello, AICodeDost!\n");
return 0;
}
/* gcc hello.c -o hello && ./hello */Remember
- Statements end with a semicolon.
- #include copies header contents in before compilation.
- main returns int.
Interview questions
What are the stages of compilation?
Preprocessing → compilation → assembly → linking.
Why is C called a middle-level language?
It has high-level constructs (functions, loops) and low-level access (pointers, bit operations, direct memory).
Lesson test
Take an 8-question test on “Introduction & First Program” — concepts, output prediction, bug spotting and interview questions.