2. Function declaration

A function declaration tells the compiler about a function’s name, return type, and parameters.

Note: A function declaration must come before function definition.

A function declaration has the following parts:

return_type function_name( parameter list );

For the above defined function max(), the following is the function declaration:

int max(int num1, int num2);

The parameter names can be omitted that finally yield

int max(int , int);

The C standard library provides numerous built-in functions that your program can call. For example, function strcat() to concatenate two strings, memcpy() to copy one memory location to another location and many more functions. A function is known with various names like a method or a sub-routine or a procedure, etc.

Leave a comment