Functions Declaration

A function has two components:

Declarative statement in which the name, return type, and necessary parameters of the function are specified (if any).

Definition, which is merely the function’s body (code to be executed)

The basic structure of a function is,

return_type functionName() { // declaration

  // body of the function (definition)


It is frequently advised to separate the function’s declaration and definition for code readability and optimization.

This is also the reason why C programmes frequently include function definitions below the main() function and function declarations above it. The code will be better organised and simpler to comprehend as a result.Here’s how to accomplish it.

#include <stdio.h>
// Function declaration
void func();
int main()
    func(); // calling the function
    return 0;
// Function definition
void func()
    printf("This is the definition part.");

Output: This is the definition part.

Shubhajna Rai
Shubhajna Rai

A Civil Engineering Graduate interested to share valuable information with the aspirants.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.