SlideShare a Scribd company logo
1 of 20
Function Recap
What is function? A function is a section of a program that performs a specific task . Solving a problem using different functions makes programming much simpler with fewer defects . It’s a solution for a big project that split into small sub project.
Common Type (FUNCTION) Void function Without argument Void unction With Input argument Function with input argument and single result
Void function without argument syntax: void functionname(void) Example: display() draw_circle() draw_triangle() The nearest explantion is printf()
Void function without argument void draw_triangle(void){ introw,space,star; for(row=1;row<=9;row++) {                            for(space=8;space>=row;space--)       { printf("%c",288);                                    };              for (star=1;star<row;star++)        { printf("* ");  }               printf(""); }                                     }
Why void? (most common seen in function without argument) Void is use when the function does not return any value More explanation: The subfunction is called draw_triangle() from the main function but the function prototype is written as void draw_triangle(void)
Void function with input argument syntax:functiontypefunctionname(input) Example: double box(123.45) circumference(5.0) calculate(inum1)
Void function with input argument void box(double num){ printf("***********"); printf("*         *"); printf("*         *"); printf("* %7.2f *",num); printf("*         *"); printf("*         *"); printf("***********"); }
#include<stdio.h> #include<conio.h> void box(double num){ printf("***********"); printf("*         *"); printf("*         *"); printf("* %7.2f *",num); printf("*         *"); printf("*         *"); printf("***********"); } int main(){    box(123.45); getch(); return 0;   }
VOID>> and what is the different between both function shown void box(double num) void draw_triangle(void)
Function with input argument and single result syntax:  functiontypefunctinname(input argument) Example: double circumferencecal(intrads);
Function with input argument and single result #include<stdio.h> #include<conio.h> double circumferencecal(intrads); intmain(){ intrads=5;  double circum;      circum=circumferencecal(rads); printf("Ukurlilitbagibulatanbagiber-radius-kan %d adalah %.4lf",rads,circum);    getch();     return 0;     } double circumferencecal(intrads){            double x;            float pi=3.1415;            x=2*pi*rads;            return(x);            }
Returning values ,[object Object]
Return statement is used to return a value to the calling function
Syntax:return (expression) ; ,[object Object],return(iNumber * iNumber);	       return 0;       return (3);       return;       return (10 * i);
Function with multiple arguments Syntax:   functionname(argument1,argument2) Example: circumferencecal(radian,PI);
#include<stdio.h> #include<conio.h> double circumferencecal(intrads,double PI); int main(){ intrads=5;  double circum,PI=3.1415;      circum=circumferencecal(rads,PI); printf("Ukurlilitbagibulatanbagiber-radius-kan %d adalah %.4lf",rads,circum); getch();     return 0;     }     double circumferencecal(intrads,double PI){            double x;                      x=2*PI*rads;            return(x);            }
Chotto complicated example #include<stdio.h> #include<conio.h> #include<math.h>  double circumferencecal(intrads,double PI){            double x;            x=2*PI*rads;            return(x);            }  double areacal(intrads,double PI){                       double y;            y=PI*pow(rads,2);            return(y);            } int main(){ intrads=5;  double area,circum,PI=3.1415;          circum=circumferencecal(rads,PI);     area=areacal(rads,PI);   printf("Ukurlilitbagibulatanbagiber-radius-kan %d adalah: %.4lfManakalaluasnya pula: %.4lf",rads,circum,area); getch();     return 0;     }
Do and Don’t in Function
GOTO

More Related Content

What's hot (20)

Lecture 3 c++
Lecture 3 c++Lecture 3 c++
Lecture 3 c++
 
detailed information about Pointers in c language
detailed information about Pointers in c languagedetailed information about Pointers in c language
detailed information about Pointers in c language
 
String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
 
C++ Programming - 4th Study
C++ Programming - 4th StudyC++ Programming - 4th Study
C++ Programming - 4th Study
 
USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2
 
C++ Programming - 11th Study
C++ Programming - 11th StudyC++ Programming - 11th Study
C++ Programming - 11th Study
 
Data Structure - 2nd Study
Data Structure - 2nd StudyData Structure - 2nd Study
Data Structure - 2nd Study
 
C Structure and Union in C
C Structure and Union in CC Structure and Union in C
C Structure and Union in C
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
Mathematics Function in C ,ppt
Mathematics Function in C ,pptMathematics Function in C ,ppt
Mathematics Function in C ,ppt
 
Unit 5 Foc
Unit 5 FocUnit 5 Foc
Unit 5 Foc
 
Pointer in C
Pointer in CPointer in C
Pointer in C
 
6. function
6. function6. function
6. function
 
Programming in c function
Programming in c functionProgramming in c function
Programming in c function
 
C++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLESC++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLES
 
Recursion in c++
Recursion in c++Recursion in c++
Recursion in c++
 
9. pointer, pointer & function
9. pointer, pointer & function9. pointer, pointer & function
9. pointer, pointer & function
 
USER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHONUSER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHON
 
Testing lecture after lec 4
Testing lecture after lec 4Testing lecture after lec 4
Testing lecture after lec 4
 
Application of Stacks
Application of StacksApplication of Stacks
Application of Stacks
 

Viewers also liked

Balancing work, home and self
Balancing work, home and selfBalancing work, home and self
Balancing work, home and selfBrad Hyde
 
Lil riding hood safe path
Lil riding hood safe pathLil riding hood safe path
Lil riding hood safe pathYuval Esroni
 
หมั่นโถวเสริมโปรตีนจากใบมะรุม
หมั่นโถวเสริมโปรตีนจากใบมะรุมหมั่นโถวเสริมโปรตีนจากใบมะรุม
หมั่นโถวเสริมโปรตีนจากใบมะรุมNattAA
 
Have a blessed 2011 ahead
Have a blessed  2011 aheadHave a blessed  2011 ahead
Have a blessed 2011 aheadhosiosky
 
goskateboardingshop shop.vinaskate.com vietnam skateboard
goskateboardingshop shop.vinaskate.com vietnam skateboardgoskateboardingshop shop.vinaskate.com vietnam skateboard
goskateboardingshop shop.vinaskate.com vietnam skateboardLinh Vo
 
CPIのACE01サーバーでマルチドメイン運用をやってみた:MTDDC Meetup TOKYO 2014
CPIのACE01サーバーでマルチドメイン運用をやってみた:MTDDC Meetup TOKYO 2014CPIのACE01サーバーでマルチドメイン運用をやってみた:MTDDC Meetup TOKYO 2014
CPIのACE01サーバーでマルチドメイン運用をやってみた:MTDDC Meetup TOKYO 2014新一 佐藤
 
Anuncios sexistas
Anuncios sexistasAnuncios sexistas
Anuncios sexistasjuanapardo
 
Lab exe 2 dti 2143 dam31303
Lab exe 2 dti 2143 dam31303Lab exe 2 dti 2143 dam31303
Lab exe 2 dti 2143 dam31303alish sha
 
Teaching people how to treat you
Teaching people how to treat youTeaching people how to treat you
Teaching people how to treat youBrad Hyde
 
愛知中小企業家同友会IT研究会 7月例会
愛知中小企業家同友会IT研究会 7月例会愛知中小企業家同友会IT研究会 7月例会
愛知中小企業家同友会IT研究会 7月例会新一 佐藤
 
あなたの時間を1秒節約します
あなたの時間を1秒節約しますあなたの時間を1秒節約します
あなたの時間を1秒節約しますTomoyuki Tochihira
 
Que saben de_ciencias_os_nosos_estudantes
Que saben de_ciencias_os_nosos_estudantesQue saben de_ciencias_os_nosos_estudantes
Que saben de_ciencias_os_nosos_estudantesjuanapardo
 
โครงงานครั้งที่........
โครงงานครั้งที่........โครงงานครั้งที่........
โครงงานครั้งที่........NattAA
 
Rèdais & IED_Penna
Rèdais & IED_PennaRèdais & IED_Penna
Rèdais & IED_PennaRèdais
 

Viewers also liked (20)

Proceso de cambios vip
Proceso de cambios vipProceso de cambios vip
Proceso de cambios vip
 
Biotecno
BiotecnoBiotecno
Biotecno
 
Balancing work, home and self
Balancing work, home and selfBalancing work, home and self
Balancing work, home and self
 
Lil riding hood safe path
Lil riding hood safe pathLil riding hood safe path
Lil riding hood safe path
 
หมั่นโถวเสริมโปรตีนจากใบมะรุม
หมั่นโถวเสริมโปรตีนจากใบมะรุมหมั่นโถวเสริมโปรตีนจากใบมะรุม
หมั่นโถวเสริมโปรตีนจากใบมะรุม
 
Have a blessed 2011 ahead
Have a blessed  2011 aheadHave a blessed  2011 ahead
Have a blessed 2011 ahead
 
MTSRetail_Cmf2012
MTSRetail_Cmf2012MTSRetail_Cmf2012
MTSRetail_Cmf2012
 
goskateboardingshop shop.vinaskate.com vietnam skateboard
goskateboardingshop shop.vinaskate.com vietnam skateboardgoskateboardingshop shop.vinaskate.com vietnam skateboard
goskateboardingshop shop.vinaskate.com vietnam skateboard
 
Social sxsw
Social sxswSocial sxsw
Social sxsw
 
Mahara
MaharaMahara
Mahara
 
CPIのACE01サーバーでマルチドメイン運用をやってみた:MTDDC Meetup TOKYO 2014
CPIのACE01サーバーでマルチドメイン運用をやってみた:MTDDC Meetup TOKYO 2014CPIのACE01サーバーでマルチドメイン運用をやってみた:MTDDC Meetup TOKYO 2014
CPIのACE01サーバーでマルチドメイン運用をやってみた:MTDDC Meetup TOKYO 2014
 
Anuncios sexistas
Anuncios sexistasAnuncios sexistas
Anuncios sexistas
 
Lab exe 2 dti 2143 dam31303
Lab exe 2 dti 2143 dam31303Lab exe 2 dti 2143 dam31303
Lab exe 2 dti 2143 dam31303
 
žYdėjimas
žYdėjimasžYdėjimas
žYdėjimas
 
Teaching people how to treat you
Teaching people how to treat youTeaching people how to treat you
Teaching people how to treat you
 
愛知中小企業家同友会IT研究会 7月例会
愛知中小企業家同友会IT研究会 7月例会愛知中小企業家同友会IT研究会 7月例会
愛知中小企業家同友会IT研究会 7月例会
 
あなたの時間を1秒節約します
あなたの時間を1秒節約しますあなたの時間を1秒節約します
あなたの時間を1秒節約します
 
Que saben de_ciencias_os_nosos_estudantes
Que saben de_ciencias_os_nosos_estudantesQue saben de_ciencias_os_nosos_estudantes
Que saben de_ciencias_os_nosos_estudantes
 
โครงงานครั้งที่........
โครงงานครั้งที่........โครงงานครั้งที่........
โครงงานครั้งที่........
 
Rèdais & IED_Penna
Rèdais & IED_PennaRèdais & IED_Penna
Rèdais & IED_Penna
 

Similar to Function Recap: What is a Function and Common Types

Dti2143 chapter 5
Dti2143 chapter 5Dti2143 chapter 5
Dti2143 chapter 5alish sha
 
An imperative study of c
An imperative study of cAn imperative study of c
An imperative study of cTushar B Kute
 
46630497 fun-pointer-1
46630497 fun-pointer-146630497 fun-pointer-1
46630497 fun-pointer-1AmIt Prasad
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1Little Tukta Lita
 
Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Ismar Silveira
 
function in in thi pdf you will learn what is fu...
function in  in thi pdf you will learn   what                           is fu...function in  in thi pdf you will learn   what                           is fu...
function in in thi pdf you will learn what is fu...kushwahashivam413
 
Function in c program
Function in c programFunction in c program
Function in c programumesh patil
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)hhliu
 
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1Little Tukta Lita
 
C++ Function
C++ FunctionC++ Function
C++ FunctionHajar
 
chapter-6 slide.pptx
chapter-6 slide.pptxchapter-6 slide.pptx
chapter-6 slide.pptxcricketreview
 

Similar to Function Recap: What is a Function and Common Types (20)

Dti2143 chapter 5
Dti2143 chapter 5Dti2143 chapter 5
Dti2143 chapter 5
 
Functions
FunctionsFunctions
Functions
 
functions
functionsfunctions
functions
 
Embedded C - Day 2
Embedded C - Day 2Embedded C - Day 2
Embedded C - Day 2
 
7 functions
7  functions7  functions
7 functions
 
An imperative study of c
An imperative study of cAn imperative study of c
An imperative study of c
 
46630497 fun-pointer-1
46630497 fun-pointer-146630497 fun-pointer-1
46630497 fun-pointer-1
 
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6  1
ฟังก์ชั่นย่อยและโปรแกรมมาตรฐาน ม. 6 1
 
Functions
FunctionsFunctions
Functions
 
Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4Paradigmas de Linguagens de Programacao - Aula #4
Paradigmas de Linguagens de Programacao - Aula #4
 
function in in thi pdf you will learn what is fu...
function in  in thi pdf you will learn   what                           is fu...function in  in thi pdf you will learn   what                           is fu...
function in in thi pdf you will learn what is fu...
 
Functions
FunctionsFunctions
Functions
 
Function in c program
Function in c programFunction in c program
Function in c program
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)
 
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
โปรแกรมย่อยและฟังชั่นมาตรฐาน ม.6 1
 
C++ Function
C++ FunctionC++ Function
C++ Function
 
Array Cont
Array ContArray Cont
Array Cont
 
C programming
C programmingC programming
C programming
 
Function
FunctionFunction
Function
 
chapter-6 slide.pptx
chapter-6 slide.pptxchapter-6 slide.pptx
chapter-6 slide.pptx
 

More from alish sha

T22016 – how to answer with ubs 9
T22016 – how to answer with ubs 9T22016 – how to answer with ubs 9
T22016 – how to answer with ubs 9alish sha
 
July 2014 theory exam (theory)
July 2014 theory exam (theory)July 2014 theory exam (theory)
July 2014 theory exam (theory)alish sha
 
Accounting basic equation
Accounting basic equation Accounting basic equation
Accounting basic equation alish sha
 
It 302 computerized accounting (week 2) - sharifah
It 302   computerized accounting (week 2) - sharifahIt 302   computerized accounting (week 2) - sharifah
It 302 computerized accounting (week 2) - sharifahalish sha
 
It 302 computerized accounting (week 1) - sharifah
It 302   computerized accounting (week 1) - sharifahIt 302   computerized accounting (week 1) - sharifah
It 302 computerized accounting (week 1) - sharifahalish sha
 
What are the causes of conflicts (Bahasa Malaysia)
What are the causes of conflicts (Bahasa Malaysia)What are the causes of conflicts (Bahasa Malaysia)
What are the causes of conflicts (Bahasa Malaysia)alish sha
 
Lab 9 sem ii_12_13
Lab 9 sem ii_12_13Lab 9 sem ii_12_13
Lab 9 sem ii_12_13alish sha
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13alish sha
 
Lab 5 2012/2012
Lab 5 2012/2012Lab 5 2012/2012
Lab 5 2012/2012alish sha
 
Purpose elaborate
Purpose elaboratePurpose elaborate
Purpose elaboratealish sha
 
Test 1 alish schema 1
Test 1 alish schema 1Test 1 alish schema 1
Test 1 alish schema 1alish sha
 
Lab 6 sem ii_11_12
Lab 6 sem ii_11_12Lab 6 sem ii_11_12
Lab 6 sem ii_11_12alish sha
 
Test 1 skema q&a
Test 1 skema q&aTest 1 skema q&a
Test 1 skema q&aalish sha
 
Test 1 skema q&a
Test 1 skema q&aTest 1 skema q&a
Test 1 skema q&aalish sha
 
Final project
Final projectFinal project
Final projectalish sha
 
Final project
Final projectFinal project
Final projectalish sha
 
Attn list test
Attn list testAttn list test
Attn list testalish sha
 
Carry markdam31303
Carry markdam31303Carry markdam31303
Carry markdam31303alish sha
 

More from alish sha (20)

T22016 – how to answer with ubs 9
T22016 – how to answer with ubs 9T22016 – how to answer with ubs 9
T22016 – how to answer with ubs 9
 
July 2014 theory exam (theory)
July 2014 theory exam (theory)July 2014 theory exam (theory)
July 2014 theory exam (theory)
 
Accounting basic equation
Accounting basic equation Accounting basic equation
Accounting basic equation
 
It 302 computerized accounting (week 2) - sharifah
It 302   computerized accounting (week 2) - sharifahIt 302   computerized accounting (week 2) - sharifah
It 302 computerized accounting (week 2) - sharifah
 
It 302 computerized accounting (week 1) - sharifah
It 302   computerized accounting (week 1) - sharifahIt 302   computerized accounting (week 1) - sharifah
It 302 computerized accounting (week 1) - sharifah
 
What are the causes of conflicts (Bahasa Malaysia)
What are the causes of conflicts (Bahasa Malaysia)What are the causes of conflicts (Bahasa Malaysia)
What are the causes of conflicts (Bahasa Malaysia)
 
Lab 9 sem ii_12_13
Lab 9 sem ii_12_13Lab 9 sem ii_12_13
Lab 9 sem ii_12_13
 
Lab 10 sem ii_12_13
Lab 10 sem ii_12_13Lab 10 sem ii_12_13
Lab 10 sem ii_12_13
 
Lab 6
Lab 6Lab 6
Lab 6
 
Lab 5 2012/2012
Lab 5 2012/2012Lab 5 2012/2012
Lab 5 2012/2012
 
Purpose elaborate
Purpose elaboratePurpose elaborate
Purpose elaborate
 
Lab sheet 1
Lab sheet 1Lab sheet 1
Lab sheet 1
 
Test 1 alish schema 1
Test 1 alish schema 1Test 1 alish schema 1
Test 1 alish schema 1
 
Lab 6 sem ii_11_12
Lab 6 sem ii_11_12Lab 6 sem ii_11_12
Lab 6 sem ii_11_12
 
Test 1 skema q&a
Test 1 skema q&aTest 1 skema q&a
Test 1 skema q&a
 
Test 1 skema q&a
Test 1 skema q&aTest 1 skema q&a
Test 1 skema q&a
 
Final project
Final projectFinal project
Final project
 
Final project
Final projectFinal project
Final project
 
Attn list test
Attn list testAttn list test
Attn list test
 
Carry markdam31303
Carry markdam31303Carry markdam31303
Carry markdam31303
 

Recently uploaded

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 

Recently uploaded (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 

Function Recap: What is a Function and Common Types

  • 2. What is function? A function is a section of a program that performs a specific task . Solving a problem using different functions makes programming much simpler with fewer defects . It’s a solution for a big project that split into small sub project.
  • 3. Common Type (FUNCTION) Void function Without argument Void unction With Input argument Function with input argument and single result
  • 4. Void function without argument syntax: void functionname(void) Example: display() draw_circle() draw_triangle() The nearest explantion is printf()
  • 5. Void function without argument void draw_triangle(void){ introw,space,star; for(row=1;row<=9;row++) { for(space=8;space>=row;space--) { printf("%c",288); }; for (star=1;star<row;star++) { printf("* "); } printf(""); } }
  • 6. Why void? (most common seen in function without argument) Void is use when the function does not return any value More explanation: The subfunction is called draw_triangle() from the main function but the function prototype is written as void draw_triangle(void)
  • 7. Void function with input argument syntax:functiontypefunctionname(input) Example: double box(123.45) circumference(5.0) calculate(inum1)
  • 8. Void function with input argument void box(double num){ printf("***********"); printf("* *"); printf("* *"); printf("* %7.2f *",num); printf("* *"); printf("* *"); printf("***********"); }
  • 9. #include<stdio.h> #include<conio.h> void box(double num){ printf("***********"); printf("* *"); printf("* *"); printf("* %7.2f *",num); printf("* *"); printf("* *"); printf("***********"); } int main(){ box(123.45); getch(); return 0; }
  • 10. VOID>> and what is the different between both function shown void box(double num) void draw_triangle(void)
  • 11. Function with input argument and single result syntax: functiontypefunctinname(input argument) Example: double circumferencecal(intrads);
  • 12. Function with input argument and single result #include<stdio.h> #include<conio.h> double circumferencecal(intrads); intmain(){ intrads=5; double circum; circum=circumferencecal(rads); printf("Ukurlilitbagibulatanbagiber-radius-kan %d adalah %.4lf",rads,circum); getch(); return 0; } double circumferencecal(intrads){ double x; float pi=3.1415; x=2*pi*rads; return(x); }
  • 13.
  • 14. Return statement is used to return a value to the calling function
  • 15.
  • 16. Function with multiple arguments Syntax: functionname(argument1,argument2) Example: circumferencecal(radian,PI);
  • 17. #include<stdio.h> #include<conio.h> double circumferencecal(intrads,double PI); int main(){ intrads=5; double circum,PI=3.1415; circum=circumferencecal(rads,PI); printf("Ukurlilitbagibulatanbagiber-radius-kan %d adalah %.4lf",rads,circum); getch(); return 0; } double circumferencecal(intrads,double PI){ double x; x=2*PI*rads; return(x); }
  • 18. Chotto complicated example #include<stdio.h> #include<conio.h> #include<math.h> double circumferencecal(intrads,double PI){ double x; x=2*PI*rads; return(x); } double areacal(intrads,double PI){ double y; y=PI*pow(rads,2); return(y); } int main(){ intrads=5; double area,circum,PI=3.1415; circum=circumferencecal(rads,PI); area=areacal(rads,PI); printf("Ukurlilitbagibulatanbagiber-radius-kan %d adalah: %.4lfManakalaluasnya pula: %.4lf",rads,circum,area); getch(); return 0; }
  • 19. Do and Don’t in Function
  • 20. GOTO
  • 21. GO TO Is a function in programming c that allows you to jump according to designation labels Syntax: gotolabel; Just simply means to redirect you to the label located in the coding label: Just simply means to redirect you to the label