Introduction to function
Functions in C-Language
Modular
Programming:
The idea of the modular
programming came from the hardware manufacturing. Hardware Components are made
by different manufacturers. Each component perform specific task. These components
combined to make a hardware device.
In
modular programming, a program consists of several independent modules, much
like hardware. These modules are called functions. Different functions can be
developed by different programmers. These modules are combined to make a
complete program.
Unstructured
programming Language
The style of writing
programs in which the entire program logic contained in a single unit is called
Unstructured programming Language.
Structured
programming Language:
The style of writing programs
in which the program logic divided into smaller structures or modules. These modules
are combined to make a complete program.
Function:
A piece of code that is designed
to perform a specific task is called Function. It is a complete independent
program. It is executed by the main function or any other function in the
program.
Importance
and Advantages of Function:
1: A large computer program may consist
of several hundred statements. If the program is written as one long program
then it may difficult to debug or test the program. To make this one easier
functions are used. Program divided into smaller section which performs some specific
tasks for which they are made.
2: Each function is
independent. That’s why it makes program easier.
3: since each function is independent
so it is written independently. Thus several programmers can develop large program
easier.
4: Use of function reduced
overall length of the program.
5: function saves the time.
Types of
Functions:
There are two types of function used in C Language.
·
Built-In Function
·
User-Defined Function
Built-In
Function:
The Function
that have already been as a part of the language is called built-in function. It
is defined and can’t be used for other purposes in c language such as variable
etc. it is also called library function. There are 32 function used in c
language.
User-Defined
Function:
The functions created by the
user are called user-defined function. These are also called programmer-defined
function. These are written to perform specific tasks for programs.
No comments:
Post a Comment