Function definitions

The elements of a function definition are as follows:

IBM extension In addition, for compatibility with C++, you can use attributes to modify the properties of functions. They are described in Function attributes.

Function definitions take the following form:

C Beginning of C only.

Function definition syntax

Read syntax diagramSkip visual syntax diagramstorage_class_specifierfunction_specifierreturn_type_specifier function_declarator {function body}

C End of C only.

C++ Beginning of C++ only.

Function definition syntax

Read syntax diagramSkip visual syntax diagramstorage_class_specifierfunction_specifierreturn_type_specifier function_declarator :constructor-initializer{function bodytry-block}

"" Note: When function_declarator incorporates a trailing return type, return_type_specifer must be auto. For more information about trailing return type, see Trailing return type (C++11).

C++ End of C++ only.