SlideShare une entreprise Scribd logo
1  sur  50
Télécharger pour lire hors ligne
A First Book of ANSI C Fourth Edition Chapter 6 Modularity Using Functions: Part I
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object]
Function and Parameter Declarations ,[object Object],[object Object]
Function and Parameter Declarations (continued)
Function and Parameter Declarations (continued)
Function Prototypes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Calling a Function ,[object Object],[object Object],[object Object],[object Object]
Calling a Function (continued)
Calling a Function (continued)
Function Header Line ,[object Object],[object Object],[object Object]
Function Header Line (continued)
Function Header Line (continued)
Function Header Line (continued) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Ends with a semicolon Does not end with a semicolon Function Header Line (continued)
Placement of Statements ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Returning a Value ,[object Object],[object Object],[object Object]
Returning a Value (continue)
Returning a Value (continue) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Returning a Value (continue)
Value is automatically converted from  double  to  float  (it may also generate a compiler warning message) Returning a Value (continue) printf("The Celsius equivalent is %5.2f", tempConvert(fahren));
Function Stubs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Functions with Empty Parameter Lists ,[object Object],[object Object],[object Object],[object Object],[object Object]
Case Study: Calculating Age Norms
Requirements Specification ,[object Object],[object Object],[object Object]
Requirements Specification (continued)
Requirements Specification (continued)
Requirements Specification (continued)
Requirements Specification (continued)
Requirements Specification (continued)
Requirements Specification (continued)
Standard Library Functions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Mathematical Library Functions
Mathematical Library Functions (continued)
The  rand()  and  srand()  Functions ,[object Object],[object Object],[object Object],[object Object],[object Object]
The  rand()  and  srand()  Functions (continued)
Scaling ,[object Object],[object Object],[object Object],[object Object],[object Object]
Coin Toss Simulation
Coin Toss Simulation (continued)
Coin Toss Simulation (continued)
Input/Output Library Functions ,[object Object],[object Object],[object Object],[object Object],[object Object]
Character Processing Functions
Character Processing Functions (continued)
Character Processing Functions (continued)
Conversion Functions
Conversion Functions (continued)
Common Programming Errors ,[object Object],[object Object],[object Object],[object Object],[object Object]
Common Compiler Errors
Common Compiler Errors (continued)
Summary ,[object Object],[object Object],[object Object],[object Object]
Summary (continued) ,[object Object],[object Object],[object Object]

Contenu connexe

Tendances

C programming | Class 8 | III Term
C programming  | Class 8  | III TermC programming  | Class 8  | III Term
C programming | Class 8 | III TermAndrew Raj
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of CSuchit Patel
 
Overview of C Mrs Sowmya Jyothi
Overview of C Mrs Sowmya JyothiOverview of C Mrs Sowmya Jyothi
Overview of C Mrs Sowmya JyothiSowmya Jyothi
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageRakesh Roshan
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to cHattori Sidek
 
Constants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya JyothiConstants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya JyothiSowmyaJyothi3
 
Functions in c mrs.sowmya jyothi
Functions in c mrs.sowmya jyothiFunctions in c mrs.sowmya jyothi
Functions in c mrs.sowmya jyothiSowmya Jyothi
 
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSTRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 
Functions in c language
Functions in c language Functions in c language
Functions in c language tanmaymodi4
 

Tendances (19)

C programming | Class 8 | III Term
C programming  | Class 8  | III TermC programming  | Class 8  | III Term
C programming | Class 8 | III Term
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of C
 
Overview of C Mrs Sowmya Jyothi
Overview of C Mrs Sowmya JyothiOverview of C Mrs Sowmya Jyothi
Overview of C Mrs Sowmya Jyothi
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C language
 
Python Objects
Python ObjectsPython Objects
Python Objects
 
Ch4 functions
Ch4 functionsCh4 functions
Ch4 functions
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
Conditional Statements
Conditional StatementsConditional Statements
Conditional Statements
 
Unit iii
Unit iiiUnit iii
Unit iii
 
C intro
C introC intro
C intro
 
Constants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya JyothiConstants Variables Datatypes by Mrs. Sowmya Jyothi
Constants Variables Datatypes by Mrs. Sowmya Jyothi
 
Looping
LoopingLooping
Looping
 
Function
FunctionFunction
Function
 
Functions in c mrs.sowmya jyothi
Functions in c mrs.sowmya jyothiFunctions in c mrs.sowmya jyothi
Functions in c mrs.sowmya jyothi
 
Ch3 repetition
Ch3 repetitionCh3 repetition
Ch3 repetition
 
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdfSTRINGS IN C MRS.SOWMYA JYOTHI.pdf
STRINGS IN C MRS.SOWMYA JYOTHI.pdf
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Getting Started with C++
Getting Started with C++Getting Started with C++
Getting Started with C++
 
Declaration of variables
Declaration of variablesDeclaration of variables
Declaration of variables
 

Similaire à Ch06

Functions in C++
Functions in C++Functions in C++
Functions in C++home
 
Functions in C++
Functions in C++Functions in C++
Functions in C++home
 
Function in c program
Function in c programFunction in c program
Function in c programumesh patil
 
User defined function in C.pptx
User defined function in C.pptxUser defined function in C.pptx
User defined function in C.pptxRhishav Poudyal
 
User Defined Functions in C
User Defined Functions in CUser Defined Functions in C
User Defined Functions in CRAJ KUMAR
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4Saranya saran
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingRasan Samarasinghe
 
functionsinc-130108032745-phpapp01.pdf
functionsinc-130108032745-phpapp01.pdffunctionsinc-130108032745-phpapp01.pdf
functionsinc-130108032745-phpapp01.pdfmounikanarra3
 
Sample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.SivakumarSample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.SivakumarSivakumar R D .
 
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptxUnit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptxvekariyakashyap
 

Similaire à Ch06 (20)

Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Function in c
Function in cFunction in c
Function in c
 
Function in c
Function in cFunction in c
Function in c
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Functions
FunctionsFunctions
Functions
 
Function in c program
Function in c programFunction in c program
Function in c program
 
C function
C functionC function
C function
 
Functionincprogram
FunctionincprogramFunctionincprogram
Functionincprogram
 
User defined function in C.pptx
User defined function in C.pptxUser defined function in C.pptx
User defined function in C.pptx
 
User Defined Functions in C
User Defined Functions in CUser Defined Functions in C
User Defined Functions in C
 
Functions struct&union
Functions struct&unionFunctions struct&union
Functions struct&union
 
Functions in C.pptx
Functions in C.pptxFunctions in C.pptx
Functions in C.pptx
 
Functions
FunctionsFunctions
Functions
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
 
Function C programming
Function C programmingFunction C programming
Function C programming
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
 
functionsinc-130108032745-phpapp01.pdf
functionsinc-130108032745-phpapp01.pdffunctionsinc-130108032745-phpapp01.pdf
functionsinc-130108032745-phpapp01.pdf
 
cp Module4(1)
cp Module4(1)cp Module4(1)
cp Module4(1)
 
Sample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.SivakumarSample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.Sivakumar
 
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptxUnit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
Unit_5Functionspptx__2022_12_27_10_47_17 (1).pptx
 

Plus de Arriz San Juan

Plus de Arriz San Juan (12)

Session 6 merchandising1
Session 6 merchandising1Session 6 merchandising1
Session 6 merchandising1
 
9. logic gates._rr
9. logic gates._rr9. logic gates._rr
9. logic gates._rr
 
7. kirchhoff s_rules
7. kirchhoff s_rules7. kirchhoff s_rules
7. kirchhoff s_rules
 
9. transistors.rr
9. transistors.rr9. transistors.rr
9. transistors.rr
 
12 exception handling
12 exception handling12 exception handling
12 exception handling
 
12 exception handling
12 exception handling12 exception handling
12 exception handling
 
Chap 17 controlling
Chap 17 controllingChap 17 controlling
Chap 17 controlling
 
11 advance inheritance_concepts
11 advance inheritance_concepts11 advance inheritance_concepts
11 advance inheritance_concepts
 
9. transistors.rr
9. transistors.rr9. transistors.rr
9. transistors.rr
 
8. semiconductors.rr
8. semiconductors.rr8. semiconductors.rr
8. semiconductors.rr
 
7. kirchhoff s_rules
7. kirchhoff s_rules7. kirchhoff s_rules
7. kirchhoff s_rules
 
Ch07
Ch07Ch07
Ch07
 

Ch06