This document discusses functions in C language. It defines functions as blocks of code that perform specific tasks. Functions can be either user-defined or library functions. There are three steps to creating a user-defined function: declaration, definition, and call. The declaration specifies the return type and parameters. The definition defines the body of the function. Functions allow code reusability and divide programs into smaller, simpler tasks to make them easier to read, update, and handle errors.
1. Function in C language
(Defination and Declaration)
Guided By Submitted By
Vikash Maurya
2. What is C language ?
Developed in1971.
It is case sensible language.
It helps to communicate with computer.
It is High Level Programming Language.
DENNIS RITCHIE
5. It is a set of block which perform specific tasks.
OR
The subprogram is called as a function.
A “C” program is a collection of one or more function.
“C” program contains at least one function which is main().
6. Types of Function
User define functionLibrary function
No Return Type Argument List
Return Type
Sub programs that is already defined in C language.
Syntax to call a function: function name();
Ex;- scanf(); printf(); clrscr(); memcpy(); strcat();
Such functions created by users
7. Steps for User Define Function
Declaration of function.
Defination of function.
Call function.
8. DECLARATION OF FUNCTION:
Return Type Function Name Argument List
void
int
float
char
User define name
Ex:- Add
int a, int b
Etc…
14. Advantages of function:
Program can be divided into a smaller, simple task.
Allowing the code to be called many times.
Easier error handling.
Easier to read and update.
Code reusability.
15. CONCLUSION:
To avoid repetition of code and bulky programs functionally related statements are
isolated into a function.
Function definition defines the body of the function.
Function declaration specifies the return type of the function and the types of
parameters it accepts.
It is very easy to perform by the given steps.
It is used by one or more times.