SlideShare a Scribd company logo
1 of 16
Function in C language
(Defination and Declaration)
Guided By Submitted By
Vikash Maurya
 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
Example:
#include<stdio.h>
#include<conio.h>
Void main() Keyword (main function)
{
int a , b; Identifier
clrscr();
a=1; Constant
b=2;
sum= a+b; Operator
Printf(“sum=%d”,sum); String
getch();
} Special Symbol
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().
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
Steps for User Define Function
 Declaration of function.
 Defination of function.
 Call function.
DECLARATION OF FUNCTION:
Return Type Function Name Argument List
void
int
float
char
User define name
Ex:- Add
int a, int b
Etc…
Defination of function:
Return Type Function Name Argument List
{
statement;
statement;
. . . . . . .
. . . . . . .
}
Call function:
Function name();
How user-define function works
#include<stdio.h>
Void functionname()
{
. . . . . . . .
. . . . . . . .
}
int main()
{
. . . . . . . .
. . . . . . . .
functionname();
. . . . . . . .
. . . . . . . .
}
Output
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.
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.
THANK YOU

More Related Content

What's hot (20)

Functions in c
Functions in cFunctions in c
Functions in c
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
Functions in C
Functions in CFunctions in C
Functions in C
 
user defined function
user defined functionuser defined function
user defined function
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Call by value
Call by valueCall by value
Call by value
 
Unit 2. Elements of C
Unit 2. Elements of CUnit 2. Elements of C
Unit 2. Elements of C
 
C tokens
C tokensC tokens
C tokens
 
C standard library functions
C standard library functionsC standard library functions
C standard library functions
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming Language
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Tokens in C++
Tokens in C++Tokens in C++
Tokens in C++
 
Inline function
Inline functionInline function
Inline function
 
Function C programming
Function C programmingFunction C programming
Function C programming
 
Unit 7. Functions
Unit 7. FunctionsUnit 7. Functions
Unit 7. Functions
 

Similar to Function Definition and Declaration in C Language

VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1YOGESH SINGH
 
Presentation on C language By Kirtika thakur
Presentation on C language By Kirtika thakurPresentation on C language By Kirtika thakur
Presentation on C language By Kirtika thakurThakurkirtika
 
Introduction to C Unit 1
Introduction to C Unit 1Introduction to C Unit 1
Introduction to C Unit 1SURBHI SAROHA
 
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).pptxSangeetaBorde3
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C ProgrammingShuvongkor Barman
 
Lecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptxLecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptxKhurramKhan173
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
Function-Definition, Need, Declaration, Definition, Arguments, Return Value
Function-Definition, Need, Declaration, Definition, Arguments, Return ValueFunction-Definition, Need, Declaration, Definition, Arguments, Return Value
Function-Definition, Need, Declaration, Definition, Arguments, Return Valuemanish maurya
 
Typescript language extension of java script
Typescript language extension of java scriptTypescript language extension of java script
Typescript language extension of java scriptmichaelaaron25322
 
Computer-programming-User-defined-function-1.pptx
Computer-programming-User-defined-function-1.pptxComputer-programming-User-defined-function-1.pptx
Computer-programming-User-defined-function-1.pptxJohnRehldeGracia
 

Similar to Function Definition and Declaration in C Language (20)

FUNCTIONS.pptx
FUNCTIONS.pptxFUNCTIONS.pptx
FUNCTIONS.pptx
 
C FUNCTIONS
C FUNCTIONSC FUNCTIONS
C FUNCTIONS
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 
Function
FunctionFunction
Function
 
C structure
C structureC structure
C structure
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Fp201 unit5 1
Fp201 unit5 1Fp201 unit5 1
Fp201 unit5 1
 
Presentation on C language By Kirtika thakur
Presentation on C language By Kirtika thakurPresentation on C language By Kirtika thakur
Presentation on C language By Kirtika thakur
 
unit_2.pptx
unit_2.pptxunit_2.pptx
unit_2.pptx
 
Introduction to C Unit 1
Introduction to C Unit 1Introduction to C Unit 1
Introduction to C Unit 1
 
Unit 3 (1)
Unit 3 (1)Unit 3 (1)
Unit 3 (1)
 
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
 
unit_2 (1).pptx
unit_2 (1).pptxunit_2 (1).pptx
unit_2 (1).pptx
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C Programming
 
Lecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptxLecture 1_Functions in C.pptx
Lecture 1_Functions in C.pptx
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Functionincprogram
FunctionincprogramFunctionincprogram
Functionincprogram
 
Function-Definition, Need, Declaration, Definition, Arguments, Return Value
Function-Definition, Need, Declaration, Definition, Arguments, Return ValueFunction-Definition, Need, Declaration, Definition, Arguments, Return Value
Function-Definition, Need, Declaration, Definition, Arguments, Return Value
 
Typescript language extension of java script
Typescript language extension of java scriptTypescript language extension of java script
Typescript language extension of java script
 
Computer-programming-User-defined-function-1.pptx
Computer-programming-User-defined-function-1.pptxComputer-programming-User-defined-function-1.pptx
Computer-programming-User-defined-function-1.pptx
 

More from VC Infotech

More from VC Infotech (14)

Covid-19
Covid-19Covid-19
Covid-19
 
Cyclotron
CyclotronCyclotron
Cyclotron
 
Vector
VectorVector
Vector
 
E wallet
E walletE wallet
E wallet
 
Gauss Divergence Therom
Gauss Divergence TheromGauss Divergence Therom
Gauss Divergence Therom
 
Hotspot!
Hotspot!Hotspot!
Hotspot!
 
Introduction of file handling
Introduction of file handlingIntroduction of file handling
Introduction of file handling
 
Windows firewall
Windows firewallWindows firewall
Windows firewall
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
computer Virus
computer Virus computer Virus
computer Virus
 
Firewall protection
Firewall protectionFirewall protection
Firewall protection
 
Frindship
FrindshipFrindship
Frindship
 
Vikash maurya
Vikash mauryaVikash maurya
Vikash maurya
 
E wallet
E walletE wallet
E wallet
 

Recently uploaded

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 

Recently uploaded (20)

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 

Function Definition and Declaration in C Language

  • 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
  • 3. Example: #include<stdio.h> #include<conio.h> Void main() Keyword (main function) { int a , b; Identifier clrscr(); a=1; Constant b=2; sum= a+b; Operator Printf(“sum=%d”,sum); String getch(); } Special Symbol
  • 4.
  • 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…
  • 9. Defination of function: Return Type Function Name Argument List { statement; statement; . . . . . . . . . . . . . . }
  • 11. How user-define function works #include<stdio.h> Void functionname() { . . . . . . . . . . . . . . . . } int main() { . . . . . . . . . . . . . . . . functionname(); . . . . . . . . . . . . . . . . }
  • 12.
  • 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.