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

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

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