尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
INTRODUCTION TO FUNCTIONS
TYPES OF FUNCTIONS
ELEMENTS OF USER DEFINED FUNCTIONS
TYPES ON THE BASIS OF ARGUMENTS AND
RETURN VALUES
METHODS OF CALLING A FUNCTION
Functions
Introduction to Function
Block of statements that perform the particular task.
Enables modular programming.
Main() is the driver function.
Has pre defined prototype.
Same function can be accessed from different places
within a program.
Once a function execution is completed , control
return to the place from where the function was
called.
Advantages
Modular Programming
Length of source program can be reduced
Easy to locate and isolate faulty function
Functions can be used by other program’s
Types of Functions
Library (Built In) Functions:
 They are written in the header files.
 To use them appropriate header files should be included.
Header Files Functions Defined
stdio.h Printf(), scanf(), getchar(), putchar(),
gets(), puts(), fopen(), fclose()
conio.h Clrscr(), getch()
Ctype.h Toupper(), tolower(), isalpha()
Math.h Pow(), sqrt(), cos(), log()
Stdlib.h Rand(), exit()
String.h Strlen(), strcpy(), strupr()
User Defined Functions
 Written by the user at the time of programming.
Elements of User defined functions
Function Prototype
Function Call
Function arguments and parameters
Function Definitions
Function prototype
It specify the type of value that is to be return from
the function and that is to be passed to the function.
It is defined in the beginning before the function call
is made.
Syntax:
 return-type name-of-function(list of arguments);
 Example
Void sum(int, int);
Function Call
A function can be called by specifying name and list
of arguments enclosed in parenthesis and separated
by comma.
If there is no arguments empty parenthesis are place
after function name.
If function return a value, function call is written as
assignment statement as:
 A=sum(x,y);
Function arguments and parameters
Arguments are also called actual parameters.
Arguments are written within parenthesis at the time
of function call.
Parameters are also called formal parameters.
These are written within parenthesis at the time of
function definition.
Function Definition
It is the independent program module.
It is written to specify the particular task that is to be
performed by the function.
The first line of the function is called function
declarator and rest line inside { } is called function
body
Return statement
It is the last statement of the function that return
certain values.
It return certain types of values to the place from
where the function was invoked.
Syntax:
 return(variable-name or constant);
Categories of function
Function with no arguments and no return
Function with arguments but no return
Function with no arguments and return
Function with arguments and return
Function with no argument and no return
Function with argument and no return
Function with no argument and return
Function with argument and return
Methods of calling function
Call by value
Call by reference
Call by value
Copies the value of actual parameters into formal
parameters.
During execution whatever changes are made in the
formal parameters are not reflected back in the
actual parameters.
Call by Reference
Reference(address) of the original variable is passed.
Function does not create its own copy, it refers to the
original values by reference.
Functions works with the original data and changes
are made in the original data.
Functions in C

More Related Content

What's hot

Array in c
Array in cArray in c
Array in c
Ravi Gelani
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
Mohammed Sikander
 
Functions in C
Functions in CFunctions in C
Functions in C
Shobhit Upadhyay
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide share
Devashish Kumar
 
Functions in python
Functions in pythonFunctions in python
Functions in python
colorsof
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
Nilesh Dalvi
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
Ritika Sharma
 
Functions in c
Functions in cFunctions in c
Functions in c
sunila tharagaturi
 
File handling in c
File handling in cFile handling in c
File handling in c
David Livingston J
 
Pointer in c
Pointer in cPointer in c
Pointer in c
lavanya marichamy
 
Data types
Data typesData types
Data types
Zahid Hussain
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
Ashok Raj
 
Strings in python
Strings in pythonStrings in python
Strings in python
Prabhakaran V M
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
kamal kotecha
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
Dhrumil Panchal
 
Data structure ppt
Data structure pptData structure ppt
Data structure ppt
Prof. Dr. K. Adisesha
 
Strings
StringsStrings
Strings
Mitali Chugh
 
Java static keyword
Java static keywordJava static keyword
Java static keyword
Lovely Professional University
 
File in C language
File in C languageFile in C language
File in C language
Manash Kumar Mondal
 
Python programming : Files
Python programming : FilesPython programming : Files
Python programming : Files
Emertxe Information Technologies Pvt Ltd
 

What's hot (20)

Array in c
Array in cArray in c
Array in c
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
 
Functions in C
Functions in CFunctions in C
Functions in C
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide share
 
Functions in python
Functions in pythonFunctions in python
Functions in python
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
 
Functions in c
Functions in cFunctions in c
Functions in c
 
File handling in c
File handling in cFile handling in c
File handling in c
 
Pointer in c
Pointer in cPointer in c
Pointer in c
 
Data types
Data typesData types
Data types
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
 
Strings in python
Strings in pythonStrings in python
Strings in python
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
 
Data structure ppt
Data structure pptData structure ppt
Data structure ppt
 
Strings
StringsStrings
Strings
 
Java static keyword
Java static keywordJava static keyword
Java static keyword
 
File in C language
File in C languageFile in C language
File in C language
 
Python programming : Files
Python programming : FilesPython programming : Files
Python programming : Files
 

Viewers also liked

Function in C Language
Function in C Language Function in C Language
Function in C Language
programmings guru
 
Presentation on function
Presentation on functionPresentation on function
Presentation on function
Abu Zaman
 
Function in c
Function in cFunction in c
Function in c
Raj Tandukar
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
Mushiii
 
Function in C
Function in CFunction in C
Function in C
Dr. Abhineet Anand
 
user defined function
user defined functionuser defined function
user defined function
King Kavin Patel
 
Loops in C
Loops in CLoops in C
Loops in C
Kamal Acharya
 
Loops in C Programming
Loops in C ProgrammingLoops in C Programming
Loops in C Programming
Himanshu Negi
 
String c
String cString c
String in c
String in cString in c
String in c
Suneel Dogra
 

Viewers also liked (10)

Function in C Language
Function in C Language Function in C Language
Function in C Language
 
Presentation on function
Presentation on functionPresentation on function
Presentation on function
 
Function in c
Function in cFunction in c
Function in c
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
 
Function in C
Function in CFunction in C
Function in C
 
user defined function
user defined functionuser defined function
user defined function
 
Loops in C
Loops in CLoops in C
Loops in C
 
Loops in C Programming
Loops in C ProgrammingLoops in C Programming
Loops in C Programming
 
String c
String cString c
String c
 
String in c
String in cString in c
String in c
 

Similar to Functions in C

function of C.pptx
function of C.pptxfunction of C.pptx
function of C.pptx
shivas379526
 
D-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptxD-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptx
VedantSahane
 
Ch4 functions
Ch4 functionsCh4 functions
Ch4 functions
Hattori Sidek
 
4. function
4. function4. function
4. function
Shankar Gangaju
 
User defined function in C.pptx
User defined function in C.pptxUser defined function in C.pptx
User defined function in C.pptx
Rhishav Poudyal
 
Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
Md. Imran Hossain Showrov
 
Functions in c
Functions in cFunctions in c
Functions in c
SunithaVesalpu
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
YOGESH SINGH
 
FUNCTION CPU
FUNCTION CPUFUNCTION CPU
FUNCTION CPU
Krushal Kakadia
 
C programming language working with functions 1
C programming language working with functions 1C programming language working with functions 1
C programming language working with functions 1
Jeevan Raj
 
Functions
Functions Functions
Functions
Dr.Subha Krishna
 
04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx
Manas40552
 
CH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptxCH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptx
SangeetaBorde3
 
Functions in c
Functions in cFunctions in c
Functions in c
kalavathisugan
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
home
 
Functions
FunctionsFunctions
Functions
Pragnavi Erva
 
Chapter 1. Functions in C++.pdf
Chapter 1.  Functions in C++.pdfChapter 1.  Functions in C++.pdf
Chapter 1. Functions in C++.pdf
TeshaleSiyum
 
Chapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdfChapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdf
TeshaleSiyum
 
Module 3-Functions
Module 3-FunctionsModule 3-Functions
Module 3-Functions
nikshaikh786
 
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
 FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM) FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
Mansi Tyagi
 

Similar to Functions in C (20)

function of C.pptx
function of C.pptxfunction of C.pptx
function of C.pptx
 
D-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptxD-38 vedant ICCPL.pptx
D-38 vedant ICCPL.pptx
 
Ch4 functions
Ch4 functionsCh4 functions
Ch4 functions
 
4. function
4. function4. function
4. function
 
User defined function in C.pptx
User defined function in C.pptxUser defined function in C.pptx
User defined function in C.pptx
 
Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
 
Functions in c
Functions in cFunctions in c
Functions in c
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 
FUNCTION CPU
FUNCTION CPUFUNCTION CPU
FUNCTION CPU
 
C programming language working with functions 1
C programming language working with functions 1C programming language working with functions 1
C programming language working with functions 1
 
Functions
Functions Functions
Functions
 
04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx04. WORKING WITH FUNCTIONS-2 (1).pptx
04. WORKING WITH FUNCTIONS-2 (1).pptx
 
CH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptxCH.4FUNCTIONS IN C_FYBSC(CS).pptx
CH.4FUNCTIONS IN C_FYBSC(CS).pptx
 
Functions in c
Functions in cFunctions in c
Functions in c
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Functions
FunctionsFunctions
Functions
 
Chapter 1. Functions in C++.pdf
Chapter 1.  Functions in C++.pdfChapter 1.  Functions in C++.pdf
Chapter 1. Functions in C++.pdf
 
Chapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdfChapter_1.__Functions_in_C++[1].pdf
Chapter_1.__Functions_in_C++[1].pdf
 
Module 3-Functions
Module 3-FunctionsModule 3-Functions
Module 3-Functions
 
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
 FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM) FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
 

More from Kamal Acharya

Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
Kamal Acharya
 
Computer Arithmetic
Computer ArithmeticComputer Arithmetic
Computer Arithmetic
Kamal Acharya
 
Introduction to Computer Security
Introduction to Computer SecurityIntroduction to Computer Security
Introduction to Computer Security
Kamal Acharya
 
Session and Cookies
Session and CookiesSession and Cookies
Session and Cookies
Kamal Acharya
 
Functions in php
Functions in phpFunctions in php
Functions in php
Kamal Acharya
 
Web forms in php
Web forms in phpWeb forms in php
Web forms in php
Kamal Acharya
 
Making decision and repeating in PHP
Making decision and repeating  in PHPMaking decision and repeating  in PHP
Making decision and repeating in PHP
Kamal Acharya
 
Working with arrays in php
Working with arrays in phpWorking with arrays in php
Working with arrays in php
Kamal Acharya
 
Text and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPText and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHP
Kamal Acharya
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
Kamal Acharya
 
Capacity Planning of Data Warehousing
Capacity Planning of Data WarehousingCapacity Planning of Data Warehousing
Capacity Planning of Data Warehousing
Kamal Acharya
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousing
Kamal Acharya
 
Search Engines
Search EnginesSearch Engines
Search Engines
Kamal Acharya
 
Web Mining
Web MiningWeb Mining
Web Mining
Kamal Acharya
 
Information Privacy and Data Mining
Information Privacy and Data MiningInformation Privacy and Data Mining
Information Privacy and Data Mining
Kamal Acharya
 
Cluster Analysis
Cluster AnalysisCluster Analysis
Cluster Analysis
Kamal Acharya
 
Association Analysis in Data Mining
Association Analysis in Data MiningAssociation Analysis in Data Mining
Association Analysis in Data Mining
Kamal Acharya
 
Classification techniques in data mining
Classification techniques in data miningClassification techniques in data mining
Classification techniques in data mining
Kamal Acharya
 
Data Preprocessing
Data PreprocessingData Preprocessing
Data Preprocessing
Kamal Acharya
 
Introduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data WarehousingIntroduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data Warehousing
Kamal Acharya
 

More from Kamal Acharya (20)

Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
 
Computer Arithmetic
Computer ArithmeticComputer Arithmetic
Computer Arithmetic
 
Introduction to Computer Security
Introduction to Computer SecurityIntroduction to Computer Security
Introduction to Computer Security
 
Session and Cookies
Session and CookiesSession and Cookies
Session and Cookies
 
Functions in php
Functions in phpFunctions in php
Functions in php
 
Web forms in php
Web forms in phpWeb forms in php
Web forms in php
 
Making decision and repeating in PHP
Making decision and repeating  in PHPMaking decision and repeating  in PHP
Making decision and repeating in PHP
 
Working with arrays in php
Working with arrays in phpWorking with arrays in php
Working with arrays in php
 
Text and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPText and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHP
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Capacity Planning of Data Warehousing
Capacity Planning of Data WarehousingCapacity Planning of Data Warehousing
Capacity Planning of Data Warehousing
 
Data Warehousing
Data WarehousingData Warehousing
Data Warehousing
 
Search Engines
Search EnginesSearch Engines
Search Engines
 
Web Mining
Web MiningWeb Mining
Web Mining
 
Information Privacy and Data Mining
Information Privacy and Data MiningInformation Privacy and Data Mining
Information Privacy and Data Mining
 
Cluster Analysis
Cluster AnalysisCluster Analysis
Cluster Analysis
 
Association Analysis in Data Mining
Association Analysis in Data MiningAssociation Analysis in Data Mining
Association Analysis in Data Mining
 
Classification techniques in data mining
Classification techniques in data miningClassification techniques in data mining
Classification techniques in data mining
 
Data Preprocessing
Data PreprocessingData Preprocessing
Data Preprocessing
 
Introduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data WarehousingIntroduction to Data Mining and Data Warehousing
Introduction to Data Mining and Data Warehousing
 

Recently uploaded

How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17
Celine George
 
The Rise of the Digital Telecommunication Marketplace.pptx
The Rise of the Digital Telecommunication Marketplace.pptxThe Rise of the Digital Telecommunication Marketplace.pptx
The Rise of the Digital Telecommunication Marketplace.pptx
PriyaKumari928991
 
Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024
Friends of African Village Libraries
 
A Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by QuizzitoA Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by Quizzito
Quizzito The Quiz Society of Gargi College
 
How to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRMHow to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRM
Celine George
 
Interprofessional Education Platform Introduction.pdf
Interprofessional Education Platform Introduction.pdfInterprofessional Education Platform Introduction.pdf
Interprofessional Education Platform Introduction.pdf
Ben Aldrich
 
The basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptxThe basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptx
heathfieldcps1
 
Cross-Cultural Leadership and Communication
Cross-Cultural Leadership and CommunicationCross-Cultural Leadership and Communication
Cross-Cultural Leadership and Communication
MattVassar1
 
pol sci Election and Representation Class 11 Notes.pdf
pol sci Election and Representation Class 11 Notes.pdfpol sci Election and Representation Class 11 Notes.pdf
pol sci Election and Representation Class 11 Notes.pdf
BiplabHalder13
 
Decolonizing Universal Design for Learning
Decolonizing Universal Design for LearningDecolonizing Universal Design for Learning
Decolonizing Universal Design for Learning
Frederic Fovet
 
Opportunity scholarships and the schools that receive them
Opportunity scholarships and the schools that receive themOpportunity scholarships and the schools that receive them
Opportunity scholarships and the schools that receive them
EducationNC
 
managing Behaviour in early childhood education.pptx
managing Behaviour in early childhood education.pptxmanaging Behaviour in early childhood education.pptx
managing Behaviour in early childhood education.pptx
nabaegha
 
Keynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse CityKeynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse City
PJ Caposey
 
The Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teachingThe Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teaching
Derek Wenmoth
 
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
220711130083 SUBHASHREE RAKSHIT  Internet resources for social science220711130083 SUBHASHREE RAKSHIT  Internet resources for social science
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
Kalna College
 
Slides Peluncuran Amalan Pemakanan Sihat.pptx
Slides Peluncuran Amalan Pemakanan Sihat.pptxSlides Peluncuran Amalan Pemakanan Sihat.pptx
Slides Peluncuran Amalan Pemakanan Sihat.pptx
shabeluno
 
Creativity for Innovation and Speechmaking
Creativity for Innovation and SpeechmakingCreativity for Innovation and Speechmaking
Creativity for Innovation and Speechmaking
MattVassar1
 
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptxScience-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Catherine Dela Cruz
 
Talking Tech through Compelling Visual Aids
Talking Tech through Compelling Visual AidsTalking Tech through Compelling Visual Aids
Talking Tech through Compelling Visual Aids
MattVassar1
 
nutrition in plants chapter 1 class 7...
nutrition in plants chapter 1 class 7...nutrition in plants chapter 1 class 7...
nutrition in plants chapter 1 class 7...
chaudharyreet2244
 

Recently uploaded (20)

How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17
 
The Rise of the Digital Telecommunication Marketplace.pptx
The Rise of the Digital Telecommunication Marketplace.pptxThe Rise of the Digital Telecommunication Marketplace.pptx
The Rise of the Digital Telecommunication Marketplace.pptx
 
Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024
 
A Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by QuizzitoA Quiz on Drug Abuse Awareness by Quizzito
A Quiz on Drug Abuse Awareness by Quizzito
 
How to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRMHow to Create a Stage or a Pipeline in Odoo 17 CRM
How to Create a Stage or a Pipeline in Odoo 17 CRM
 
Interprofessional Education Platform Introduction.pdf
Interprofessional Education Platform Introduction.pdfInterprofessional Education Platform Introduction.pdf
Interprofessional Education Platform Introduction.pdf
 
The basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptxThe basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptx
 
Cross-Cultural Leadership and Communication
Cross-Cultural Leadership and CommunicationCross-Cultural Leadership and Communication
Cross-Cultural Leadership and Communication
 
pol sci Election and Representation Class 11 Notes.pdf
pol sci Election and Representation Class 11 Notes.pdfpol sci Election and Representation Class 11 Notes.pdf
pol sci Election and Representation Class 11 Notes.pdf
 
Decolonizing Universal Design for Learning
Decolonizing Universal Design for LearningDecolonizing Universal Design for Learning
Decolonizing Universal Design for Learning
 
Opportunity scholarships and the schools that receive them
Opportunity scholarships and the schools that receive themOpportunity scholarships and the schools that receive them
Opportunity scholarships and the schools that receive them
 
managing Behaviour in early childhood education.pptx
managing Behaviour in early childhood education.pptxmanaging Behaviour in early childhood education.pptx
managing Behaviour in early childhood education.pptx
 
Keynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse CityKeynote given on June 24 for MASSP at Grand Traverse City
Keynote given on June 24 for MASSP at Grand Traverse City
 
The Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teachingThe Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teaching
 
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
220711130083 SUBHASHREE RAKSHIT  Internet resources for social science220711130083 SUBHASHREE RAKSHIT  Internet resources for social science
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
 
Slides Peluncuran Amalan Pemakanan Sihat.pptx
Slides Peluncuran Amalan Pemakanan Sihat.pptxSlides Peluncuran Amalan Pemakanan Sihat.pptx
Slides Peluncuran Amalan Pemakanan Sihat.pptx
 
Creativity for Innovation and Speechmaking
Creativity for Innovation and SpeechmakingCreativity for Innovation and Speechmaking
Creativity for Innovation and Speechmaking
 
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptxScience-9-Lesson-1-The Bohr Model-NLC.pptx pptx
Science-9-Lesson-1-The Bohr Model-NLC.pptx pptx
 
Talking Tech through Compelling Visual Aids
Talking Tech through Compelling Visual AidsTalking Tech through Compelling Visual Aids
Talking Tech through Compelling Visual Aids
 
nutrition in plants chapter 1 class 7...
nutrition in plants chapter 1 class 7...nutrition in plants chapter 1 class 7...
nutrition in plants chapter 1 class 7...
 

Functions in C

  • 1. INTRODUCTION TO FUNCTIONS TYPES OF FUNCTIONS ELEMENTS OF USER DEFINED FUNCTIONS TYPES ON THE BASIS OF ARGUMENTS AND RETURN VALUES METHODS OF CALLING A FUNCTION Functions
  • 2. Introduction to Function Block of statements that perform the particular task. Enables modular programming. Main() is the driver function. Has pre defined prototype. Same function can be accessed from different places within a program. Once a function execution is completed , control return to the place from where the function was called.
  • 3. Advantages Modular Programming Length of source program can be reduced Easy to locate and isolate faulty function Functions can be used by other program’s
  • 4. Types of Functions Library (Built In) Functions:  They are written in the header files.  To use them appropriate header files should be included. Header Files Functions Defined stdio.h Printf(), scanf(), getchar(), putchar(), gets(), puts(), fopen(), fclose() conio.h Clrscr(), getch() Ctype.h Toupper(), tolower(), isalpha() Math.h Pow(), sqrt(), cos(), log() Stdlib.h Rand(), exit() String.h Strlen(), strcpy(), strupr()
  • 5. User Defined Functions  Written by the user at the time of programming.
  • 6. Elements of User defined functions Function Prototype Function Call Function arguments and parameters Function Definitions
  • 7. Function prototype It specify the type of value that is to be return from the function and that is to be passed to the function. It is defined in the beginning before the function call is made. Syntax:  return-type name-of-function(list of arguments);  Example Void sum(int, int);
  • 8. Function Call A function can be called by specifying name and list of arguments enclosed in parenthesis and separated by comma. If there is no arguments empty parenthesis are place after function name. If function return a value, function call is written as assignment statement as:  A=sum(x,y);
  • 9. Function arguments and parameters Arguments are also called actual parameters. Arguments are written within parenthesis at the time of function call. Parameters are also called formal parameters. These are written within parenthesis at the time of function definition.
  • 10. Function Definition It is the independent program module. It is written to specify the particular task that is to be performed by the function. The first line of the function is called function declarator and rest line inside { } is called function body
  • 11.
  • 12. Return statement It is the last statement of the function that return certain values. It return certain types of values to the place from where the function was invoked. Syntax:  return(variable-name or constant);
  • 13. Categories of function Function with no arguments and no return Function with arguments but no return Function with no arguments and return Function with arguments and return
  • 14. Function with no argument and no return
  • 15. Function with argument and no return
  • 16. Function with no argument and return
  • 18. Methods of calling function Call by value Call by reference
  • 19. Call by value Copies the value of actual parameters into formal parameters. During execution whatever changes are made in the formal parameters are not reflected back in the actual parameters.
  • 20.
  • 21. Call by Reference Reference(address) of the original variable is passed. Function does not create its own copy, it refers to the original values by reference. Functions works with the original data and changes are made in the original data.
  翻译: