SlideShare a Scribd company logo
Function
Syntax of function
Declaration section
<<Returntype>> funname(parameter list);
Definition section
<<Returntype>> funname(parameter list)
{
body of the function
}
Function Call
Funname(parameter);
Example
#include<stdio.h>
void fun(int a); //declaration
int main()
{
fun(10); //Call
}
void fun(int x) //definition
{
printf(“%d”,x);
}
ACTUAL & FORMAL PARAMETERS
Actual parameters are those that are used during a
function call
Formal parameters are those that are used in function
definition and function declaration
Call by value
Calling a function with parameters passed as
values
int a=10; void fun(int a)
fun(a); {
defn;
}
Here fun(a) is a call by value.
Any modification done within the function is local to
it and will not be effected outside the function
Call By Reference
Calling a function by passing pointers as
parameters (address of variables is passed instead
of variables)
int a=1; void fun(int *x)
fun(&a); {
defn;
}
Any modification done to variable a will effect
outside the function also
Illustration
a and x are referring to same location. So value will be over written.
Illustration
Difference between call by value and
call by reference
Call by value => copying value of variable in another
variable. So any change made in the copy will not
affect the original location
Call by reference => Creating link for the parameter
to the original location. Since the address is same,
changes to the parameter will refer to original
location and the value will be over written

More Related Content

PPT
Pre defined Functions in C
PPTX
Call by value
PPTX
Call by value
PPTX
PPTX
Call by value or call by reference in C++
PPTX
Function in c program
PPTX
Functions (Computer programming and utilization)
ODP
Function
Pre defined Functions in C
Call by value
Call by value
Call by value or call by reference in C++
Function in c program
Functions (Computer programming and utilization)
Function

What's hot (20)

PPTX
parameter passing in c#
PPT
Functions in c
PPTX
functions of C++
PPTX
Functionincprogram
PPT
Functions in C++
PDF
Lec21-CS110 Computational Engineering
PDF
Function lecture
PPTX
Conversion of Infix to Prefix and Postfix with Stack
PPTX
Recursion in c++
PPTX
Function in c++
PPTX
Tail Recursion in data structure
PPT
Lecture#6 functions in c++
PPTX
How c program execute in c program
DOCX
Chapter 5
PPTX
C++ programming function
PPTX
C structure
PPT
Functions
PPTX
C and C++ functions
PPTX
Function C++
parameter passing in c#
Functions in c
functions of C++
Functionincprogram
Functions in C++
Lec21-CS110 Computational Engineering
Function lecture
Conversion of Infix to Prefix and Postfix with Stack
Recursion in c++
Function in c++
Tail Recursion in data structure
Lecture#6 functions in c++
How c program execute in c program
Chapter 5
C++ programming function
C structure
Functions
C and C++ functions
Function C++
Ad

Viewers also liked (9)

PPT
Array & string
PPT
Unions in c
PPT
Intro to c programming
PPT
Pointers in C
PPT
File in c
PPT
Memory allocation in c
PDF
Pointers and call by value, reference, address in C
PPT
Preprocessor in C
PPT
Structure in c
Array & string
Unions in c
Intro to c programming
Pointers in C
File in c
Memory allocation in c
Pointers and call by value, reference, address in C
Preprocessor in C
Structure in c
Ad

Similar to Recursive For S-Teacher (20)

PDF
Functions-Computer programming
PPTX
Presentation on function
PPT
User Defined Functions in C
PDF
VIT351 Software Development VI Unit1
PDF
Programming in C Functions PPT Presentation.pdf
PPTX
Functions in C.pptx
PPTX
PPTX
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
PDF
PSPC-UNIT-4.pdf
PPTX
unit_2 (1).pptx
PPTX
Detailed concept of function in c programming
PPTX
unit_2.pptx
PPTX
Function C programming
PPTX
CH.4FUNCTIONS IN C (1).pptx
PPTX
3 Function & Storage Class.pptx
PPTX
functions in the c programming and the examples
PPTX
PDF
C_Dayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 3.pdf
PPTX
FUNCTIONengineeringtechnologyslidesh.pptx
PPTX
FUNCTION.pptxfkrdutytrtttrrtttttttttttttt
Functions-Computer programming
Presentation on function
User Defined Functions in C
VIT351 Software Development VI Unit1
Programming in C Functions PPT Presentation.pdf
Functions in C.pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
PSPC-UNIT-4.pdf
unit_2 (1).pptx
Detailed concept of function in c programming
unit_2.pptx
Function C programming
CH.4FUNCTIONS IN C (1).pptx
3 Function & Storage Class.pptx
functions in the c programming and the examples
C_Dayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy 3.pdf
FUNCTIONengineeringtechnologyslidesh.pptx
FUNCTION.pptxfkrdutytrtttrrtttttttttttttt

More from Prabhu Govind (16)

PPT
User defined Functions in C
PPT
Looping in C
PPT
Branching in C
PPT
Types of operators in C
PPT
Operators in C
PPT
Statements in C
PPT
Data types in C
PPT
Constants in C
PPT
Variables_c
PPT
Tokens_C
PDF
Computer basics
PDF
Computer fundamentals
PDF
computer hardware and software
PPT
Software
PPT
Intro computer fundamentals
PPTX
C programming deta
User defined Functions in C
Looping in C
Branching in C
Types of operators in C
Operators in C
Statements in C
Data types in C
Constants in C
Variables_c
Tokens_C
Computer basics
Computer fundamentals
computer hardware and software
Software
Intro computer fundamentals
C programming deta

Recently uploaded (20)

PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
advance database management system book.pdf
PDF
1_English_Language_Set_2.pdf probationary
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Introduction to Building Materials
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
Indian roads congress 037 - 2012 Flexible pavement
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
What if we spent less time fighting change, and more time building what’s rig...
PPTX
Unit 4 Skeletal System.ppt.pptxopresentatiom
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
RMMM.pdf make it easy to upload and study
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PDF
Classroom Observation Tools for Teachers
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Weekly quiz Compilation Jan -July 25.pdf
advance database management system book.pdf
1_English_Language_Set_2.pdf probationary
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Introduction to Building Materials
Paper A Mock Exam 9_ Attempt review.pdf.
Indian roads congress 037 - 2012 Flexible pavement
Orientation - ARALprogram of Deped to the Parents.pptx
What if we spent less time fighting change, and more time building what’s rig...
Unit 4 Skeletal System.ppt.pptxopresentatiom
Final Presentation General Medicine 03-08-2024.pptx
RMMM.pdf make it easy to upload and study
UNIT III MENTAL HEALTH NURSING ASSESSMENT
Classroom Observation Tools for Teachers
LDMMIA Reiki Yoga Finals Review Spring Summer
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
A powerpoint presentation on the Revised K-10 Science Shaping Paper
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS

Recursive For S-Teacher

  • 1. Function Syntax of function Declaration section <<Returntype>> funname(parameter list); Definition section <<Returntype>> funname(parameter list) { body of the function } Function Call Funname(parameter);
  • 2. Example #include<stdio.h> void fun(int a); //declaration int main() { fun(10); //Call } void fun(int x) //definition { printf(“%d”,x); }
  • 3. ACTUAL & FORMAL PARAMETERS Actual parameters are those that are used during a function call Formal parameters are those that are used in function definition and function declaration
  • 4. Call by value Calling a function with parameters passed as values int a=10; void fun(int a) fun(a); { defn; } Here fun(a) is a call by value. Any modification done within the function is local to it and will not be effected outside the function
  • 5. Call By Reference Calling a function by passing pointers as parameters (address of variables is passed instead of variables) int a=1; void fun(int *x) fun(&a); { defn; } Any modification done to variable a will effect outside the function also
  • 6. Illustration a and x are referring to same location. So value will be over written.
  • 8. Difference between call by value and call by reference Call by value => copying value of variable in another variable. So any change made in the copy will not affect the original location Call by reference => Creating link for the parameter to the original location. Since the address is same, changes to the parameter will refer to original location and the value will be over written