Syntax

C Main Function Syntax

In C, main function: the entry point of a C program — int main(void) { return 0; }

Quick Answer

Syntax
int main(void) { return 0; }
CSyntax

Main Function

Code example
int main(void) { return 0; }

The entry point of a C program.

Learn More

How to main function in C

  1. Open your C file or editor.
  2. Copy the example, then replace its sample names and values for your code.

C Main Function Syntax

Use int main(void) { return 0; }.

Related Syntax References

Frequently asked questions

What is the C syntax for main function?

Use this pattern: int main(void) { return 0; }

Can I copy this C code example?

Yes. Use Copy code and adapt the example to your program.

Is this C syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify