Saturday, September 5, 2020

C Function

‘C’ Language is a programming language which pre-describe and self made Function for doing work. Pre describe functions are called Library function

 Computer Science

‘C’ Function or Subroutine

Summary

  1. C Function:

  2. Type of Function:

  3. Grade/Level:

  4. Objective:

  1. Time Allotment:

Introduction

‘C’ Language is a programming language which pre-describe and self made Function for doing work. Pre describe functions are also called Library function. ‘C’ program use Library function for working but if program is big or complex then modularity is used to form it. In this, the bigger program is divided into smaller-smaller simple (easy) programs which are independent to each other, so in this way we make that bigger program by joining these smaller one. ‘C’ language comes under the modular type.

C Function

Function is a group of self contained or independent statement which do a specific or particular function. When bigger program is split into smaller program and then they are executed according to the main function, so this sub-program is called as function. Function has the following advantages.

  1. After dividing bigger Function into smaller one is can be read easily.

  2. To understand this smaller function is very simple as computer to bigger Function.

  3. Testing and error find in this smaller program is very easy then doing in bigger one.

  4. Statement occur more than once in the function, is put once in an function can use when ever needed.

  5. User can make it's own library according to it's need.

Type of Function

  1. Library Function

  2. User Defined Function


Library Function : These are those Function which are already stored in (language user can use these function directly in program. These are written when ‘C’ Language is developed. These function is divided in different Header file such as print f ( ), scan f ( ), getch ( ), clrscr ( ), etc.


User Defined Function : These are those which user form according to it's need or according to program. In other words, sub-program form the user according to the need of program is called as User Defined Function.

Important facts regarding function

Every function have a unique name by which it is identify
Name given to function or variable by identifier always follow the rule of it
For execution of a function, it is necessary to call it by function such as main ( ) etc.
Function is developed to doing some specific work (purpose).
Like variable, function before using it told and describe. So it is self contained part for program.

Function prototype

In 'C' language with user defined function main ( ) function. There should be also be function prototype, which is necessary. Like variable, function should also be defined before using in the program. This prototype is written before the main ( ) function. Function is defined with the help of calling program function prototype. It looks as function header. Syntax of prototype in calling program is as follows.


<Type><Function_name>  (parameter list)



Vibhor Sharma

Author & Editor

###

0 comments:

Post a Comment