Share this post on:

Function in C is a object which has certain functionality to perform a particular task. It is block of statement which perform task.

There are two types of function:

  • Pre-defined function
  • User-defined function

Pre-Defined Function in C

Pre-defined Function : Pre-defined functions are already defined and ready made available for use although we can use any predefined function but before using it we must include Header files.

Header files contains definitions of related functions

C provides several types of Header files, some common Header files are :-

Stdio.h :- This header files contains various standard input output functions like Printf, scanf, etc.

Conio.h :- This header file contains various concole input output functions like clrscr, getch, etc.

Goto xy function :- This function set the cursor at the specified position of the output screen.

Example :

goto xy(row, column)

printf (“Hi);

goto xy (20, 25)

printf (“Hi”);

String.h :- This header file contains various string manipulation functions like Strlan, strcpy, etc.

Math.h:- This header file contains various mathematical function like : sin(x) , cos(x), tan(x), sqrt(x), tabs(x), pow(x,y), col(x).

Dos.h :- This header file contain dos base function.

Example : delay

Delay :- This function hold the output of specified micro seconds.

stdLiv.h :- This header file contains various standard library functions.

Example : exit

alloc.h :- This header file contains various dynamic memory allocation like malloc(), calloc(), realloc().

graphic.h :- This header file contains various graphics function like line(), cycle(), rectangle, setcolor(), ets.

User-Defined Function in C

User-defined function : User defined function is defined by the user according to their requirements. The major advantages of user defined function is its reusability and reliability. Using user defined function we can divide large and complex program into several small modules for effective maintanenece.


void show() —-> Prototype declaration

void main();


printf(“In main”);

printf(“go in show”);


printf(“again go in show”);




void show()




In user defined function we get three major component:

  • Prototype Declaration
  • Calling
  • Declaration

Prototype Declaration : As we know we can refer anything without its proper declaration. Here before using user defined function we must declare it.

The general format is : return type fucntionname();

Calling : It means to transfer the control from calling function to called function & after the executing of called function control will be again transferred from called to calling. To call a function we use calling statement.

The general format is : functioname();

Declaration : It is used to defined a function. It indicates what operation to be performed by the function.

The general format is : return type functionname() { function body }

Declaration must be similar to the declaration but it can’t be terminated.

Share this post on:
Avatar Raiyan

Author: Raiyan

Hi, I guess you're here because you want to know a bit about me. huh? I am not so good on talking about myself but I'll give a short about me.

My Name is Raiyan. I am a Professional Application Developer and a Blogger.
I started this website to Share my Knowledge. Here I provide all my knowledge whatever I earned till now.


  1. Pingback: What are Types of Function in C Programming - ArzaTechs

  2. Pingback: What are Variable in C Programming - ArzaTechs

  3. Pingback: How to use String in C Programming? - ArzaTechs

  4. Pingback: Dynamic Memory Allocation in C Programming - ArzaTechs

Leave a Comment

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