SlideShare a Scribd company logo
Functions (Computer programming and utilization)
Functions (Computer programming and utilization)
Functions (Computer programming and utilization)
These are the in- -built functions of ‘C ’library.
These are already defined in header files.
e.g. printf( ); is a function which is used to print
at output. It is defined in ‘stdio.h ’ file .
Programmer can create their own function in C
to perform specific task
Advantages of function
Functions (Computer programming and utilization)
(1) Function with no arguments and no return
values.
(2) Function with arguments and no return values.
(3) Function with arguments and return values.
(4) Function with no arguments and return values.
 When a function has no arguments it does not
receive any information from the calling function.
 Similarly when it does not return any value the
calling function does not receive any information
from the called function.
 Function has the actual arguments that are
assigned to the formal arguments in the function
definition.
o Actual parameters are used in the function call.
o Formal parameters are used in function definition.
o Both the arguments should match in number, type
and order.
o The values of actual arguments are assigned to
the formal arguments on a one to one basis
starting with the first argument.
 The function call transfers the actual arguments
to the particular function where the formal
arguments are created and are assigned the
memory space and are given the values of the
actual arguments.
 The called function is executed until the return
statement is encountered. The return value is
passed back to the function.
 The return value is thus assigned to the calling
function.
 When a function has no arguments it does
not receive any information from the calling
function.
 The called function is executed until the return
statement is encountered. The return value is
passed back to the function.
When we use value during
the function call then it is
known as call by value.
#include <stdio.h>
Void main()
{
Void swap(int,int);
Int x=10,y=20;
Swap(x,y);
Printf(“x=%d & y=%d”,x,y);
Void swap(int a,int b)
{
Int t;
t=a
a=b
b=t;
Printf(“x=%d & y=%d”,a,b,);
}
 In this instead of passing value, address are
passed.
 Here formal arguments are pointers to the
actual arguments
 Hence change made in the argument are
permanent.
Void main()
{
int a=10
void swap(int *x,int *y)
{
int z;
z=*x;
*x=*y;
*y=z;
Printf(”x=%d&y=%d”,*a*b);
Output:
before function calling a= 10 b= 25
value of x=25 and y=10
after function calling a=25 b= 10
Functions (Computer programming and utilization)
 In recursion, function may directly or
indirectly call it self – If the call to a
function occurs inside the function itself
it is called direct recursion.
 If the function calls another function,
which in turn makes a call to the first
one, it is called indirect recursion.
<type> function name(<argument list>)
{
………………
……………….
function name(…);
………………
…..............
}
 Avoids unnecessary calling of functions.
 Solves problems in easier way than using
iterative loop.
You reduce size of the code when you see
recursive call.
 Complex programs can be easily written using
recursion.
 Too many recursive functions may
cause confusion in the code.
 Recursive solution is logical and it is
difficult to debug and understand.
 Program execution becomes slower as
the function call and return takes longer
time.
Functions (Computer programming and utilization)

More Related Content

What's hot (20)

PPTX
functions in C
Mehwish Mehmood
 
PPTX
Call by value
Dharani G
 
PPTX
Function Pointer
Dr-Dipali Meher
 
PPT
lets play with "c"..!!! :):)
Rupendra Choudhary
 
PPTX
parameter passing in c#
khush_boo31
 
PDF
C standard library functions
Vaishnavee Sharma
 
PPT
Lecture 11 - Functions
Md. Imran Hossain Showrov
 
DOCX
Maharishi University of Management (MSc Computer Science test questions)
Dharma Kshetri
 
PPT
CPP Language Basics - Reference
Mohammed Sikander
 
PPTX
C function
thirumalaikumar3
 
PPT
Function in C Language
programmings guru
 
PPTX
Pointers lesson 5 (double pointer, call by value, call_by_reference)
SetuMaheshwari1
 
PDF
Unit 3 (1)
Sowri Rajan
 
PPTX
Function
mshoaib15
 
PPTX
Method parameters in c#
Dr.Neeraj Kumar Pandey
 
PPT
Lecture 5
Mohammed Saleh
 
PPTX
Functions
Jesmin Akhter
 
PPT
Functions and pointers_unit_4
Saranya saran
 
PPT
Lecture 8- Data Input and Output
Md. Imran Hossain Showrov
 
functions in C
Mehwish Mehmood
 
Call by value
Dharani G
 
Function Pointer
Dr-Dipali Meher
 
lets play with "c"..!!! :):)
Rupendra Choudhary
 
parameter passing in c#
khush_boo31
 
C standard library functions
Vaishnavee Sharma
 
Lecture 11 - Functions
Md. Imran Hossain Showrov
 
Maharishi University of Management (MSc Computer Science test questions)
Dharma Kshetri
 
CPP Language Basics - Reference
Mohammed Sikander
 
C function
thirumalaikumar3
 
Function in C Language
programmings guru
 
Pointers lesson 5 (double pointer, call by value, call_by_reference)
SetuMaheshwari1
 
Unit 3 (1)
Sowri Rajan
 
Function
mshoaib15
 
Method parameters in c#
Dr.Neeraj Kumar Pandey
 
Lecture 5
Mohammed Saleh
 
Functions
Jesmin Akhter
 
Functions and pointers_unit_4
Saranya saran
 
Lecture 8- Data Input and Output
Md. Imran Hossain Showrov
 

Similar to Functions (Computer programming and utilization) (20)

PPTX
Detailed concept of function in c programming
anjanasharma77573
 
ODP
Function
jayesh30sikchi
 
PPTX
Functions in c language
tanmaymodi4
 
PPTX
Functions in c language
Tanmay Modi
 
PDF
Functions
Pragnavi Erva
 
DOC
4. function
Shankar Gangaju
 
PPTX
C and C++ functions
kavitha muneeshwaran
 
PPT
eee2-day4-structures engineering college
2017eee0459
 
PPTX
C Programming Language Part 7
Rumman Ansari
 
PPTX
Functions in c language1
sirikeshava
 
PPTX
unit_2 (1).pptx
JVenkateshGoud
 
PDF
VIT351 Software Development VI Unit1
YOGESH SINGH
 
PDF
Programming in C Functions PPT Presentation.pdf
Ramesh Wadawadagi
 
DOC
Unit 4 (1)
psaravanan1985
 
PPTX
C functions
University of Potsdam
 
PPTX
Function in c program
umesh patil
 
PPTX
Presentation on Function in C Programming
Shuvongkor Barman
 
PPTX
Functions in C.pptx
Ashwini Raut
 
PPTX
Functionincprogram
Sampath Kumar
 
PDF
User Defined Functions in C Language
Infinity Tech Solutions
 
Detailed concept of function in c programming
anjanasharma77573
 
Function
jayesh30sikchi
 
Functions in c language
tanmaymodi4
 
Functions in c language
Tanmay Modi
 
Functions
Pragnavi Erva
 
4. function
Shankar Gangaju
 
C and C++ functions
kavitha muneeshwaran
 
eee2-day4-structures engineering college
2017eee0459
 
C Programming Language Part 7
Rumman Ansari
 
Functions in c language1
sirikeshava
 
unit_2 (1).pptx
JVenkateshGoud
 
VIT351 Software Development VI Unit1
YOGESH SINGH
 
Programming in C Functions PPT Presentation.pdf
Ramesh Wadawadagi
 
Unit 4 (1)
psaravanan1985
 
Function in c program
umesh patil
 
Presentation on Function in C Programming
Shuvongkor Barman
 
Functions in C.pptx
Ashwini Raut
 
Functionincprogram
Sampath Kumar
 
User Defined Functions in C Language
Infinity Tech Solutions
 
Ad

More from Digvijaysinh Gohil (20)

PPTX
Hydraulic cranes
Digvijaysinh Gohil
 
PPTX
Hydraulic braking systems
Digvijaysinh Gohil
 
PPTX
Human resources management
Digvijaysinh Gohil
 
PPTX
Traits of a good listner (Communication Skills)
Digvijaysinh Gohil
 
PPT
Techniques of reading (Communication Skills)
Digvijaysinh Gohil
 
PPTX
Proxemics (Communication Skills)
Digvijaysinh Gohil
 
PPTX
Proxemics (2) (Communication Skills)
Digvijaysinh Gohil
 
PPTX
Paralinguistic (Communication Skills)
Digvijaysinh Gohil
 
PPTX
Paralinguistic (2) (Communication Skills)
Digvijaysinh Gohil
 
PPTX
Paralinguistic (1) (Communication Skills)
Digvijaysinh Gohil
 
PPTX
Organizing a contents &amp; preparing an outline
Digvijaysinh Gohil
 
PPTX
Organizing a contents &amp; preparing an outline (2)
Digvijaysinh Gohil
 
PPTX
Kinesics (Communication Skills)
Digvijaysinh Gohil
 
PPTX
Kinesics (3) (Communication Skills)
Digvijaysinh Gohil
 
PPTX
Kinesics (2) (Communication Skills)
Digvijaysinh Gohil
 
PPTX
Introduction to communication (Communication Skills)
Digvijaysinh Gohil
 
PPTX
Email etiquette (Communication Skills)
Digvijaysinh Gohil
 
PPTX
Welded joints (machine design & industrial drafting )
Digvijaysinh Gohil
 
PPTX
Types of stresses and theories of failure (machine design & industrial drafti...
Digvijaysinh Gohil
 
PPTX
Treaded joint (machine design & industrial drafting )
Digvijaysinh Gohil
 
Hydraulic cranes
Digvijaysinh Gohil
 
Hydraulic braking systems
Digvijaysinh Gohil
 
Human resources management
Digvijaysinh Gohil
 
Traits of a good listner (Communication Skills)
Digvijaysinh Gohil
 
Techniques of reading (Communication Skills)
Digvijaysinh Gohil
 
Proxemics (Communication Skills)
Digvijaysinh Gohil
 
Proxemics (2) (Communication Skills)
Digvijaysinh Gohil
 
Paralinguistic (Communication Skills)
Digvijaysinh Gohil
 
Paralinguistic (2) (Communication Skills)
Digvijaysinh Gohil
 
Paralinguistic (1) (Communication Skills)
Digvijaysinh Gohil
 
Organizing a contents &amp; preparing an outline
Digvijaysinh Gohil
 
Organizing a contents &amp; preparing an outline (2)
Digvijaysinh Gohil
 
Kinesics (Communication Skills)
Digvijaysinh Gohil
 
Kinesics (3) (Communication Skills)
Digvijaysinh Gohil
 
Kinesics (2) (Communication Skills)
Digvijaysinh Gohil
 
Introduction to communication (Communication Skills)
Digvijaysinh Gohil
 
Email etiquette (Communication Skills)
Digvijaysinh Gohil
 
Welded joints (machine design & industrial drafting )
Digvijaysinh Gohil
 
Types of stresses and theories of failure (machine design & industrial drafti...
Digvijaysinh Gohil
 
Treaded joint (machine design & industrial drafting )
Digvijaysinh Gohil
 
Ad

Recently uploaded (20)

PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PPTX
GitOps_Repo_Structure for begeinner(Scaffolindg)
DanialHabibi2
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PDF
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PPT
PPT2_Metal formingMECHANICALENGINEEIRNG .ppt
Praveen Kumar
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PPTX
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
PDF
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PPTX
Green Building & Energy Conservation ppt
Sagar Sarangi
 
PPTX
Server Side Web Development Unit 1 of Nodejs.pptx
sneha852132
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PPTX
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PDF
monopile foundation seminar topic for civil engineering students
Ahina5
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
GitOps_Repo_Structure for begeinner(Scaffolindg)
DanialHabibi2
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
Design Thinking basics for Engineers.pdf
CMR University
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PPT2_Metal formingMECHANICALENGINEEIRNG .ppt
Praveen Kumar
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
Biomechanics of Gait: Engineering Solutions for Rehabilitation (www.kiu.ac.ug)
publication11
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
Green Building & Energy Conservation ppt
Sagar Sarangi
 
Server Side Web Development Unit 1 of Nodejs.pptx
sneha852132
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
Solar Thermal Energy System Seminar.pptx
Gpc Purapuza
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
monopile foundation seminar topic for civil engineering students
Ahina5
 

Functions (Computer programming and utilization)

  • 4. These are the in- -built functions of ‘C ’library. These are already defined in header files. e.g. printf( ); is a function which is used to print at output. It is defined in ‘stdio.h ’ file . Programmer can create their own function in C to perform specific task
  • 7. (1) Function with no arguments and no return values. (2) Function with arguments and no return values. (3) Function with arguments and return values. (4) Function with no arguments and return values.
  • 8.  When a function has no arguments it does not receive any information from the calling function.  Similarly when it does not return any value the calling function does not receive any information from the called function.
  • 9.  Function has the actual arguments that are assigned to the formal arguments in the function definition. o Actual parameters are used in the function call. o Formal parameters are used in function definition. o Both the arguments should match in number, type and order. o The values of actual arguments are assigned to the formal arguments on a one to one basis starting with the first argument.
  • 10.  The function call transfers the actual arguments to the particular function where the formal arguments are created and are assigned the memory space and are given the values of the actual arguments.  The called function is executed until the return statement is encountered. The return value is passed back to the function.  The return value is thus assigned to the calling function.
  • 11.  When a function has no arguments it does not receive any information from the calling function.  The called function is executed until the return statement is encountered. The return value is passed back to the function.
  • 12. When we use value during the function call then it is known as call by value.
  • 13. #include <stdio.h> Void main() { Void swap(int,int); Int x=10,y=20; Swap(x,y); Printf(“x=%d & y=%d”,x,y);
  • 14. Void swap(int a,int b) { Int t; t=a a=b b=t; Printf(“x=%d & y=%d”,a,b,); }
  • 15.  In this instead of passing value, address are passed.  Here formal arguments are pointers to the actual arguments  Hence change made in the argument are permanent.
  • 17. void swap(int *x,int *y) { int z; z=*x; *x=*y; *y=z; Printf(”x=%d&y=%d”,*a*b);
  • 18. Output: before function calling a= 10 b= 25 value of x=25 and y=10 after function calling a=25 b= 10
  • 20.  In recursion, function may directly or indirectly call it self – If the call to a function occurs inside the function itself it is called direct recursion.  If the function calls another function, which in turn makes a call to the first one, it is called indirect recursion.
  • 21. <type> function name(<argument list>) { ……………… ………………. function name(…); ……………… ….............. }
  • 22.  Avoids unnecessary calling of functions.  Solves problems in easier way than using iterative loop. You reduce size of the code when you see recursive call.  Complex programs can be easily written using recursion.
  • 23.  Too many recursive functions may cause confusion in the code.  Recursive solution is logical and it is difficult to debug and understand.  Program execution becomes slower as the function call and return takes longer time.