No matter what the purpose of a function is, the "syntax" for defining it is always the same. A Design Pattern is presented below to show this syntax. Your job is to memorize this design pattern, but until you do, you can cut and paste it from here.
All functions in C always use the same basic pattern (syntax). This syntax can be captured in a "Design Pattern". Your job is to memorize this pattern for future use (and tests). When learning, you can refer here for help.
All C functions will be written following the below "pattern".
/*
* COMMENT as to what function does
*/
RETURN_TYPE
name_of_function( TYPE parameter1, TYPE parameter2, etc )
{
// CODE goes here
return 0; //or other default.
}
Above the word TYPE (or RETURN_TYPE) represent one of the basic data types in C, including numbers (int, float, or double), bools, chars, arrays, and structures. RETURN_TYPE can be any of these except arrays.