Bifalgorithm post · Computer science one · Declaration: Prototypes
What information does a C function prototype specify?
What information does a C function prototype specify? (Computer science one · Declaration: Prototypes) — "Typically, the documentation for functions is include…
Ideas in this flowchart
- Function prototypes and their documentation
- Documentation is included with the prototype and not repeated with the function definition.
- This documentation practice follows the Don’t Repeat Yourself (DRY) principle.
- The examples use a commenting style called doc comments.
- Doc comments were originally developed for Java and later adopted by many other languages.
- Examples of documented function prototypes
- The sum prototype computes the sum of two arguments.
- The getDistance prototype computes the Euclidean distance between two-dimensional points.
- The getMonthlyPayment prototype computes a loan’s monthly payment.
- A prototype specifies the return type first and the function identifier second.
- Function names follow variable naming rules: they begin with an alphabetic character and may contain alphanumeric characters and underscores.
- Modern coding conventions usually use lower camel casing for function names.
- Each function prototype ends with a semicolon.
- A prototype specifies a function’s signature, not what the function does.