What are Functions in C?

Function is the collection of statements which is used to perform some specific task. It provides code reusability and code optimization.

Syntax to declare function in C

return_type function_name(data_type parameter...){
  • return_type indicates the data type of the return value.
  • function_name specify the name of the functions.
  • Parameter are the values which is passed in the function.

A function declaration informs the compiler about a function name and how to call the function. The actual body of the function can be defined separately.
Syntax to call function in C



#include <stdio.h>
#include <conio.h>
void sum(int a, int b);
void main()
int a, b, c;
c= sum(2,3);
void sum(int a, int b)
c = a+b;


If you want to know about C Strings, refer to our C programs blog!

2 Ways of Calling Function

  1. Call by value
  2. Call by reference

Certification in Full Stack Web Development

1. Call by value

This method copies the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function have no effect on the argument.

2. Call by reference

This method copies the address of an argument into the formal parameter. Inside the function, the address is used to access the actual argument used in the call. This means that changes made to the parameter affect the argument.


When function is called within the same function, it is known as recursion in C. A function that calls itself, and doesn’t perform any task after function call, is known as tail recursion.

recursionfunction();//calling self function

If you want to know about File Handling in C, refer to our C programs blog!

Course Schedule

Name Date
Python Course 2022-10-08 2022-10-09
(Sat-Sun) Weekend batch
View Details
Python Course 2022-10-15 2022-10-16
(Sat-Sun) Weekend batch
View Details
Python Course 2022-10-22 2022-10-23
(Sat-Sun) Weekend batch
View Details

Leave a Reply

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