Definitions
Go Up to Functions Index (C++)
The general syntax for external function definitions is as follows:
External function definitions
file external-definition file external-definition external-definition: function-definition declaration asm-statement function-definition: <decl-specifiers> declarator <declaration-list> function-body
In general, a function definition consists of the following sections (the grammar allows for more complicated cases):
- Optional storage class specifiers: extern or static. The default is extern.
- A return type, possibly void. The default is int.
- Optional modifiers: __pascal, __cdecl, __export. The defaults depend on the compiler option settings.
- The name of the function.
- A parameter declaration list, possibly empty, enclosed in parentheses. In C, the preferred way of showing an empty list is func(void). The old style of func is legal in C but antiquated and possibly unsafe.
- A function body representing the code to be executed when the function is called.
Note: You can mix elements from 1 and 2.