Introduction to Function in C

Functions In C


programming language, the user just needs to call the function whenever the user wants to use the function.

The example of system-defined functions are printf( ),scanf( ),getsThe functions are known as giving some output for one particular input or argument, we already work with functions like main( ), printf( ),scanf( ) in your  c programs.

functions in C are use full in case of reducing code, to improve readability and reuse of code. If we want to perform a certain task frequently with different-different values or parameters then the use of function is convenient for us. It helps to reduce, reuse and improve the readability of your program.

there are two types of functions

  1. system-defined functions

  2. user-defined functions


system-defined functions:

system-defined functions are already defined by the ( ),puts( ),pow( )... that are already defined by the system we just need to include the file/library that contains the function declaration for use these functions. for example we need to include stdio.h to use function like printf( ),scanf( ).

user-defined functions:

user-defined functions are created and used by the user to reduce, reuse, and maintain the code. In this type of function, the user needs to define all the things related to the function like a prototype, and definition of a function that we are going to learn next in this series.