Tutorials

C Tutorial

All Tutorials Learning Tools Login

C Tutorial · Chapter 3 of 16

C Syntax

The basic shape of a C program.

A typical C file includes headers, then main(), then statements ending with semicolons.

Curly braces { } mark blocks. Indentation is for humans; the compiler cares about braces and syntax.

return 0; usually means the program finished successfully.

Syntax skeleton Try it Yourself »
#include <stdio.h>

int main(void) {
    // statement area
    printf("Syntax matters.\n");
    return 0;
}

Classroom Tips

  • Missing semicolon is a common beginner error.
  • Keep main neat and readable.