A function prototype is a declaration of a function that tells the compiler its name, return type, and parameters without giving the full code. Placing prototypes before the main() function or in separate header files helps the compiler check that functions are used correctly before they are defined.
Header files, which have a .h extension, usually contain these prototypes along with useful code like macros and structure definitions. They allow multiple program files to share the same functions and data structures without repeating code. This way, changes in one place can automatically apply everywhere, improving the organization and reusability of your programs.
// In mylib.h
int square(int);
// In main.c
#include “mylib.h”