GTU # 3110003
USING
Functions {C}
Programming
PROGRAMING OF PROBLEM SOLVING (PPS)
Prof. Nilesh Gambhava
LAXMI INSTITUTE OF TECHNOLOGY
Computer Engineering Department, (LIT)
Darshan Institute of Engineering & Technology, Rajkot
,What is Function?
A function is a group of statements that perform a specific task.
It divides a large program into smaller parts.
A function is something like hiring a person to do a specific job for you.
Every C program can be thought of as a collection of these functions.
Program execution in C language starts from the main function.
Syntax
void main()
{
// body part
}
Why function ?
Avoids rewriting the same code over and over.
Using functions it becomes easier to write programs and keep track of what they doing.
Prof. Nilesh Gambhava #3110003 (PPS) – Functions
, Types of Function
Function
Library Function User Defined Function (UDF)
Predefined or inbuilt Created by User
Declarations inside header files Programmer need to declare it
Eg. printf() – stdio.h Eg. findSimpleInterest()
pow() – math.h areaOfCircle()
strcmp() – string.h
Prof. Nilesh Gambhava #3110003 (PPS) – Functions