Functions and recursion: Difference between revisions

Line 26: Line 26:


===The <tt>main<tt> Function===
===The <tt>main<tt> Function===
The <tt>main<tt> function is a special function. Every C++ program must contain a function named "main". It serves as the entry point for the program. The computer will start running the code form the beginning of the main function.
The <tt>main<tt> function is a special function. Every C++ program must contain a function named "main". It serves as the entry point for the program. The computer will start running the code from the beginning of the main function.
There are two main types of <tt>main<tt> functions; one with and one without parameters. Below are examples of both:
There are two main types of <tt>main<tt> functions; one with and one without parameters. Below are examples of both:
<pre>
<pre>