What is Function in C

C functions are basic building blocks in a program. All C programs are written using functions to improve re-usability, understandability and to keep track on them.

  A large C program is divided into basic building blocks called C function. C function contains set of instructions enclosed by "{ }" which performs specific operation in a C program. Actually, Collection of these functions creates a C program.


Some of uses are as follows:-

  C functions are used to avoid rewriting same logic/code again and again in a program.

  There is no limit in calling C functions to make use of same functionality wherever required.

  We can call functions any number of times in a program and from any place in a program.

  A large C program can easily be tracked when it is divided into functions.

  The core concept of C functions are, re-usability, dividing a big task into small pieces to achieve the functionality and to improve understandability of very large C programs.


There are two types of functions in C programming:

  Library Functions : are the functions which are declared in the C header files such as scanf(), printf(), gets(), puts(), ceil(), floor() etc.

  User-defined functions: are the functions which are created by the C programmer, so that he/she can use it many times. It reduces complexity of a big program and optimizes the code.


woman avatar

What we are going to learn in C Functions