Javatpoint Logo
Javatpoint Logo

What is the function call in C?

Before jumping to the function call, we need to understand the function in the C programming language. A function is a group of tasks used to execute the predefined operations and returns a value. A large program can be divided into small blocks of code that help to understand the logic, debug, and modified it.

What is the function call in C

In the C programming language, the function is divided into two parts: the built-in/ library function and the user-defined function.

Library/ Built-in Function

A library function is predefined functions, and its tasks are also defined in the C header files. So, it does not require writing the code of the particular function; instead, it can be called directly in a program whenever it is required. Example: printf(), scanf(), getch(), etc., are the predefined function in the C library, and the meaning of these functions cannot be changed.

Let's write a program to define the library function in C.



Welcome to the
It is the library function or built-in function in C

User-defined Function

It is a user-defined function in the C programming language to execute some specific actions according to the programmer's requirement. A user-defined function is divided into three types such as function declaration, function definition, and function call.

Function Declaration

A function declaration defines the name and return type of a function in a program. Before using the function, we need to declare it outside of a main() function in a program.


Example of function declaration:

In the above example, int is a return data type of the function name add function that contains two integer parameters as num1 and num2. Furthermore, we can write the above function declaration is as follows:

Function Definition

It defines the actual body of a function inside a program for executing their tasks in C.


In the above syntax, a function definition contains the three parts as follow:

  1. Return Data_Type: It defines the return data type of a value in the function. The return data type can be integer, float, character, etc.
  2. Function Name: It defines the actual name of a function that contains some parameters.
  3. Parameters/ Arguments: It is a parameter that passed inside the function name of a program. Parameters can be any type, order, and the number of parameters.
  4. Function Body: It is the collection of the statements to be executed for performing the specific tasks in a function.

Consider an example to demonstrate the function definition:

Function Calling:

A function call is an important part of the C programming language. It is called inside a program whenever it is required to call a function. It is only called by its name in the main() function of a program. We can pass the parameters to a function calling in the main() function.


Let's consider a program to call a function in C programming languages.



Enter the first and second number
The sum of the two number is 11

Call by Value:

When single or multiple values of an actual argument are copied into the formal parameter of a function, the method is called the Call by Value. Hence, it does not alter the function's actual parameter using the formal parameter.

Consider a program to demonstrate the Call by Value in C programming.



x = 10, y = 20 from main before calling the function
x = 15, y = 25 from modular function
 x = 10, y = 20 from main after calling the function

Call by Reference:

In this method, the address of the actual argument is copied into the function call's formal parameter; the method is known as Call by Reference. If we make some changes in the formal parameters, it shows the effect in the value of the actual parameter.

Consider a program to demonstrate the Call by Reference in C programming.



x = 10, y = 20 from main before calling the function
x = 15, y = 25 from modular function
 x = 15, y = 25 from main after calling the function

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA