What is Function in C

What is Function in C

In this tutorial, we will study what is function in c programming languages and the types of function (pre-defined functions and user-defined functions), and the syntax of the function. So let’s start.

What is Function in C?

In order to solve a problem of C language, it should solve all those parts of the weights in small parts and add all the parts at the end and these small types of different types related to a problem are called functions. By using Functions, saving both the programmer's time and the computer's memory. With the help of Function, we can use the same code again and again.

Types of Function

The function are two types

  • Pre-defined functions
  • User-defined functions

Pre-defined Functions

The functions that we already get to use directly For example: - prinf (); clrscr (); getch (); etc. All these functions are already received by us, to use them, you have to include this header file in your source program.

When using any predefined functions in your source program, this process is called the calling function. Pre-define functions are also called built-in functions.

User-defined Functions

The functions that the programmer develops on the basis of their need are called user define function if the program can do all the work without creating a user-defined function But creating the function reduces the comparability of the program. Creating functions makes it easy to debug the program. The programmer creates the user define function according to the way it is created.

Function Declaration

 <return-type> <function-name>(<list-of-parameters>);

Function syntax

<return-type> <function-name>(<list-of-parameters>)
{
  statement 1; 
  statement 2;
  .
  .
  statement n;
}

Function Call

<function-name>(<arguments-list>);

Learn into deep - What is function in c programming