eolas/zk/Entry_point_to_C_programs.md
2025-12-03 17:59:30 +00:00

493 B

tags
C

Entry point to C programs

int main(void)
{
    // Instructions
}

The braces wrap all code that comprises the program.

The return type is int. It receives no arguments so the arguments are void.

Why does it return an int?

It returns an int because the main function returns a success code: 0 for success and 1 for error.

As C was divised to create Unix, this fits in with other Unix-like OS behaviour such as bash scripts returning 0/1.