All variables and functions must be declared before they are used in main()


Declaring a function prototype informs the compiler of what to expect in terms of memory resources for that function, by letting main() know what data type it returns and the argument data types the function expects.


A function prototype, consists of the return data type and signature of the function, terminated by a semi-colon ; without the body of the function.


The function can then be defined after main()


#include <stdio.h>

void hello() ;

int main() {


    return 0;

void hello() {
    printf("Hello, World! \n");


This methodology is called function prototyping, and provides a neat way to structure your programs with as many functions as required following main().


This gives the code good readability, as one can easily dip in and out of main() when reading the code, to view the required function, understand what its doing and what its returning (if anything) back into main()

Leave a Reply