Member-only story
A Function Prototype
In C, all functions must be written to return a specific TYPE of information and to take in specific types of data (parameters). This information is communicated to the compiler via a function prototype.
Here is the syntax for the function declaration or Prototype:
A Prototype can occur at the top of a C source code file to describe what the function returns and what it takes (return type and parameter list). When this is the case (occuring at the top of the file), the function prototype
should be followed by a semi-colon
The function prototype is also used at the beginning of the code for the function. Thus the prototype can occur twice in a C source code file. When the prototype occurs with the code NO semicolon is used.
The Main Function
In C, the "main" function is treated the same as every function, it has a return type (and in some cases accepts inputs via parameters). The only difference is that the main function is "called" by the operating system when the user runs the program. Thus the main function is always the first code executed when a program starts.