C Programming Important Concepts Programming

How to call a function in C

A Function is a set of statements combine together to form a small program which we can call again and again in our program and use it. The need for a function arises because it enhances the concept of code reusability.

Creating and using a function in our program can be divided into 3 parts:

  • Function Declaration
  • Function Definition
  • Function Calling

Calling a function in our program

Before calling any function in our program, firstly we need to create that function. A function can be created by declaring its name & giving it a proper definition. So it may be divided into two parts,

  1. Function Declaration – Sometimes we need to declare our function before the main() function as if we want to give its definition later.
  2. Function Definition – Function definition refers to the process of writing code inside the function so that it gets a proper definition.

Syntax to declare a function:

return_type function_name(parameter_list);


Syntax to defined a function:

retrun_type function_name(Parameters)

  //Body of funtion


For Example –

int product(int x,int y)
  retrun x*y;

Calling a function inside the main()

A function can be called by just wiring its name inside the main() function and by passing the arguments in it.

For example:

int main()



Example of function calling

using namespace std;
int prod(int x,int y);
int main()
 int a,b;
 cout<<"Enter two numbers";
 cout<<"Product is:";

int prod(int x,int y)
 retrun x*y;



-> Use Of Header File In C ( Easy Explanation With Pictures & List)

-> C program to concatenate two strings With Algorithm

-> Division in c program ( A step-by-step easy guide )

Leave a Reply