SlideShare a Scribd company logo
1 of 10
FUNCTION / FUNGSI
Modular Programming
Sebuah program yang besar dibagi menjadi sejumlah modul kecil
(function). Setiap function mengerjakan tugas tertentu.
Keuntungan:
Rancangan Top down dengan pendekatan divide dan conquer.
Dapat dikerjakan dalam tim
Lebih mudah mengalkasikan kesalahan
Modifikasi dapat dilakukan tanpa menganggu program secara
keseluruhan
Mempermudah dokumentasi
Function
Standard library function, adalah fungsi funsi
standard yang sudah disediakan oleh C. Untuk
menggunakannya kita harus mencantumkan header
file dari fungsi tersebut. (dengan perintah #include)
Programmer / User Define Function, adalah fungsi
yang dibuat oleh programmer untuk digunakan
dalam program yang dibuat.
Standard Library Function
Contoh :
#include <stdio.h>
Beberapa fungsi yang terdapat dalam stdio.h :
printf()
scanf()
getchar()
gets()
puts()
Programmer-Defined Function
Dalam merancang sebuah function harus diperhatikan
sbb:
INPUT (data apa yang akan menjadi masukkan
fungsi)
PROSES (bagaimana algoritma yang akan digunakan
dalam fungsi tersebut)
OUTPUT (informasi apa yang akan dikembalikan
oleh fungsi kepada si pemanggil)
PROSES
INPUT
OUTPUT
Programmer-Defined Function
Penulisan fungsi dibagi atas :
Protototype (pendeklarasikan fungsi) yaitu kepala atau judul
fungsi (sebagai pengenal fungsi).
Definition yaitu penulisan fungsi secara lengkap.
Contoh :
int luas(int p, int l); // prototype
// definition
int luas(int p, int l) {
return p*l;
}
Contoh Penggunaan Fungsi
// Contoh Fungsi
#include <stdio.h>
#include <conio.h>
int penjumlahan(int a, int b) {
int r;
r=a+b;
return (r);
}
int main()
{ int z;
z=penjumlahan(5,3);
printf("Hasil penjumlahan = %d",z);
return 0;
}
Penjelasan Fungsi
Ketika program dieksekusi, yang dijalankan pertama
kali adalah fungsi main().
Terlihat jelas bahwa dalam main() terdapat variable z
dengan tipe data integer.
Setelah itu, fungsi penjumlahan dipanggil. Maka akan
terdapat proses pertukaran data sebagai berikut:
int penjumlahan(int a, int b)
z = penjumlahan ( 5 , 3 );
Penjelasan Fungsi
Maka setelah terjadi pengisian nilai, variable a akan terisi dengan nilai 5
dan variable b akan terisi dengan nilai 3.
Fungsi penjumlahan mendeklarasikan sebuah variable baru lagi (int r;)
dan
kemudian menjumlahkan nilai r=a+b; dengan hasil akhir variable r = 8.
return (r);
merupakan pengakhir fungsi penjumlahan dan memberikan hasil akhir
nilai r kepada fungsi yang memanggilnya (dalam hal ini fungsi
main()). Proses pengembalian nilai dapat digambarkan sebagai
berikut:
int penjumlahan(int a, int b)
8
z = penjumlahan ( 5 , 3 );
Nilai 8 hasil dari fungsi dikembalikan ke pemanggilnya.
END

More Related Content

What's hot

Algoritma dan Struktur Data - Sintaks C++
Algoritma dan Struktur Data - Sintaks C++Algoritma dan Struktur Data - Sintaks C++
Algoritma dan Struktur Data - Sintaks C++KuliahKita
 
Pengenalan Bahasa C
Pengenalan Bahasa CPengenalan Bahasa C
Pengenalan Bahasa Cguestaf3e8f4
 
Lapopran praktikum struktur data pertemuan 1 Tipe Data
Lapopran praktikum struktur data pertemuan 1  Tipe DataLapopran praktikum struktur data pertemuan 1  Tipe Data
Lapopran praktikum struktur data pertemuan 1 Tipe DataAdy Achirul
 
Function
FunctionFunction
Functionwindi1
 
Pertemuan 9 : Algoritma & Pemrograman
Pertemuan 9 : Algoritma & PemrogramanPertemuan 9 : Algoritma & Pemrograman
Pertemuan 9 : Algoritma & PemrogramanTri Retna
 
09 pd fungsi rekursif
09 pd fungsi rekursif09 pd fungsi rekursif
09 pd fungsi rekursifSofi Orient
 
Algoritma dan Struktur Data - Rekursif
Algoritma dan Struktur Data - RekursifAlgoritma dan Struktur Data - Rekursif
Algoritma dan Struktur Data - RekursifKuliahKita
 
Pemrograman C++ - Sintaks Dasar
Pemrograman C++ - Sintaks DasarPemrograman C++ - Sintaks Dasar
Pemrograman C++ - Sintaks DasarKuliahKita
 

What's hot (20)

Function
FunctionFunction
Function
 
Pertemuan 12 Structure
Pertemuan 12 StructurePertemuan 12 Structure
Pertemuan 12 Structure
 
Topik 10 Fungsi
Topik 10 FungsiTopik 10 Fungsi
Topik 10 Fungsi
 
Function c++
Function c++Function c++
Function c++
 
Algoritma
AlgoritmaAlgoritma
Algoritma
 
Algoritma dan Struktur Data - Sintaks C++
Algoritma dan Struktur Data - Sintaks C++Algoritma dan Struktur Data - Sintaks C++
Algoritma dan Struktur Data - Sintaks C++
 
Function
FunctionFunction
Function
 
Pengenalan Bahasa C
Pengenalan Bahasa CPengenalan Bahasa C
Pengenalan Bahasa C
 
Lapopran praktikum struktur data pertemuan 1 Tipe Data
Lapopran praktikum struktur data pertemuan 1  Tipe DataLapopran praktikum struktur data pertemuan 1  Tipe Data
Lapopran praktikum struktur data pertemuan 1 Tipe Data
 
Fungsi dan Prosedur
Fungsi dan ProsedurFungsi dan Prosedur
Fungsi dan Prosedur
 
Function
FunctionFunction
Function
 
Function
FunctionFunction
Function
 
Pertemuan II Function
Pertemuan II FunctionPertemuan II Function
Pertemuan II Function
 
Pertemuan 9 : Algoritma & Pemrograman
Pertemuan 9 : Algoritma & PemrogramanPertemuan 9 : Algoritma & Pemrograman
Pertemuan 9 : Algoritma & Pemrograman
 
09 pd fungsi rekursif
09 pd fungsi rekursif09 pd fungsi rekursif
09 pd fungsi rekursif
 
3 adp operator
3   adp operator3   adp operator
3 adp operator
 
Algoritma dan Struktur Data - Rekursif
Algoritma dan Struktur Data - RekursifAlgoritma dan Struktur Data - Rekursif
Algoritma dan Struktur Data - Rekursif
 
Function dalam PHP
Function dalam PHPFunction dalam PHP
Function dalam PHP
 
Pemrograman C++ - Sintaks Dasar
Pemrograman C++ - Sintaks DasarPemrograman C++ - Sintaks Dasar
Pemrograman C++ - Sintaks Dasar
 
Function pada PHP
Function pada PHPFunction pada PHP
Function pada PHP
 

Viewers also liked

Introductory maths analysis chapter 12 official
Introductory maths analysis   chapter 12 officialIntroductory maths analysis   chapter 12 official
Introductory maths analysis chapter 12 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 14 official
Introductory maths analysis   chapter 14 officialIntroductory maths analysis   chapter 14 official
Introductory maths analysis chapter 14 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 17 official
Introductory maths analysis   chapter 17 officialIntroductory maths analysis   chapter 17 official
Introductory maths analysis chapter 17 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 16 official
Introductory maths analysis   chapter 16 officialIntroductory maths analysis   chapter 16 official
Introductory maths analysis chapter 16 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 09 official
Introductory maths analysis   chapter 09 officialIntroductory maths analysis   chapter 09 official
Introductory maths analysis chapter 09 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 11 official
Introductory maths analysis   chapter 11 officialIntroductory maths analysis   chapter 11 official
Introductory maths analysis chapter 11 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 07 official
Introductory maths analysis   chapter 07 officialIntroductory maths analysis   chapter 07 official
Introductory maths analysis chapter 07 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 00 official
Introductory maths analysis   chapter 00 officialIntroductory maths analysis   chapter 00 official
Introductory maths analysis chapter 00 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 10 official
Introductory maths analysis   chapter 10 officialIntroductory maths analysis   chapter 10 official
Introductory maths analysis chapter 10 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 15 official
Introductory maths analysis   chapter 15 officialIntroductory maths analysis   chapter 15 official
Introductory maths analysis chapter 15 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 06 official
Introductory maths analysis   chapter 06 officialIntroductory maths analysis   chapter 06 official
Introductory maths analysis chapter 06 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 05 official
Introductory maths analysis   chapter 05 officialIntroductory maths analysis   chapter 05 official
Introductory maths analysis chapter 05 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 03 official
Introductory maths analysis   chapter 03 officialIntroductory maths analysis   chapter 03 official
Introductory maths analysis chapter 03 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 13 official
Introductory maths analysis   chapter 13 officialIntroductory maths analysis   chapter 13 official
Introductory maths analysis chapter 13 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 01 official
Introductory maths analysis   chapter 01 officialIntroductory maths analysis   chapter 01 official
Introductory maths analysis chapter 01 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 04 official
Introductory maths analysis   chapter 04 officialIntroductory maths analysis   chapter 04 official
Introductory maths analysis chapter 04 officialEvert Sandye Taasiringan
 
Introductory maths analysis chapter 02 official
Introductory maths analysis   chapter 02 officialIntroductory maths analysis   chapter 02 official
Introductory maths analysis chapter 02 officialEvert Sandye Taasiringan
 
31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manual31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manualMahrukh Khalid
 

Viewers also liked (20)

01 01-algoritma
01 01-algoritma01 01-algoritma
01 01-algoritma
 
Introductory maths analysis chapter 12 official
Introductory maths analysis   chapter 12 officialIntroductory maths analysis   chapter 12 official
Introductory maths analysis chapter 12 official
 
Introductory maths analysis chapter 14 official
Introductory maths analysis   chapter 14 officialIntroductory maths analysis   chapter 14 official
Introductory maths analysis chapter 14 official
 
Introductory maths analysis chapter 17 official
Introductory maths analysis   chapter 17 officialIntroductory maths analysis   chapter 17 official
Introductory maths analysis chapter 17 official
 
03 i-o
03 i-o03 i-o
03 i-o
 
Introductory maths analysis chapter 16 official
Introductory maths analysis   chapter 16 officialIntroductory maths analysis   chapter 16 official
Introductory maths analysis chapter 16 official
 
Introductory maths analysis chapter 09 official
Introductory maths analysis   chapter 09 officialIntroductory maths analysis   chapter 09 official
Introductory maths analysis chapter 09 official
 
Introductory maths analysis chapter 11 official
Introductory maths analysis   chapter 11 officialIntroductory maths analysis   chapter 11 official
Introductory maths analysis chapter 11 official
 
Introductory maths analysis chapter 07 official
Introductory maths analysis   chapter 07 officialIntroductory maths analysis   chapter 07 official
Introductory maths analysis chapter 07 official
 
Introductory maths analysis chapter 00 official
Introductory maths analysis   chapter 00 officialIntroductory maths analysis   chapter 00 official
Introductory maths analysis chapter 00 official
 
Introductory maths analysis chapter 10 official
Introductory maths analysis   chapter 10 officialIntroductory maths analysis   chapter 10 official
Introductory maths analysis chapter 10 official
 
Introductory maths analysis chapter 15 official
Introductory maths analysis   chapter 15 officialIntroductory maths analysis   chapter 15 official
Introductory maths analysis chapter 15 official
 
Introductory maths analysis chapter 06 official
Introductory maths analysis   chapter 06 officialIntroductory maths analysis   chapter 06 official
Introductory maths analysis chapter 06 official
 
Introductory maths analysis chapter 05 official
Introductory maths analysis   chapter 05 officialIntroductory maths analysis   chapter 05 official
Introductory maths analysis chapter 05 official
 
Introductory maths analysis chapter 03 official
Introductory maths analysis   chapter 03 officialIntroductory maths analysis   chapter 03 official
Introductory maths analysis chapter 03 official
 
Introductory maths analysis chapter 13 official
Introductory maths analysis   chapter 13 officialIntroductory maths analysis   chapter 13 official
Introductory maths analysis chapter 13 official
 
Introductory maths analysis chapter 01 official
Introductory maths analysis   chapter 01 officialIntroductory maths analysis   chapter 01 official
Introductory maths analysis chapter 01 official
 
Introductory maths analysis chapter 04 official
Introductory maths analysis   chapter 04 officialIntroductory maths analysis   chapter 04 official
Introductory maths analysis chapter 04 official
 
Introductory maths analysis chapter 02 official
Introductory maths analysis   chapter 02 officialIntroductory maths analysis   chapter 02 official
Introductory maths analysis chapter 02 official
 
31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manual31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manual
 

Similar to 07 function 2

Materi kuliah 18 fungsi part 1
Materi kuliah 18   fungsi part 1Materi kuliah 18   fungsi part 1
Materi kuliah 18 fungsi part 1Budi Yono
 
Materi kuliah 18 fungsi part 1
Materi kuliah 18   fungsi part 1Materi kuliah 18   fungsi part 1
Materi kuliah 18 fungsi part 1kua
 
Pertemuan vi (Function Java)
Pertemuan vi (Function Java)Pertemuan vi (Function Java)
Pertemuan vi (Function Java)Putra Andry
 
Laporan praktikum modul vi
Laporan praktikum modul viLaporan praktikum modul vi
Laporan praktikum modul viDevi Apriansyah
 
Cara membuat fungsi dan prosedur pada java
Cara membuat fungsi dan prosedur pada javaCara membuat fungsi dan prosedur pada java
Cara membuat fungsi dan prosedur pada javaDevandy Enda
 
Pertemuan 12
Pertemuan 12Pertemuan 12
Pertemuan 12beiharira
 
5 adp fungsi & rekursi
5   adp fungsi & rekursi5   adp fungsi & rekursi
5 adp fungsi & rekursiChabil_Juniar
 
5.adp fungsi & rekursi
5.adp fungsi & rekursi5.adp fungsi & rekursi
5.adp fungsi & rekursiHardini_HD
 
5 adp fungsi & rekursi
5   adp fungsi & rekursi5   adp fungsi & rekursi
5 adp fungsi & rekursiAvenzz Venzz
 
5 adp fungsi & rekursi
5   adp fungsi & rekursi5   adp fungsi & rekursi
5 adp fungsi & rekursiFisma Ananda
 
5 adp fungsi & rekursi
5   adp fungsi & rekursi5   adp fungsi & rekursi
5 adp fungsi & rekursiFaisal Amir
 
4. pemrograman fungsi
4. pemrograman fungsi4. pemrograman fungsi
4. pemrograman fungsiRoziq Bahtiar
 

Similar to 07 function 2 (20)

Praktikum
PraktikumPraktikum
Praktikum
 
Fungsi
FungsiFungsi
Fungsi
 
Week 3-fungsi-header
Week 3-fungsi-headerWeek 3-fungsi-header
Week 3-fungsi-header
 
Materi kuliah 18 fungsi part 1
Materi kuliah 18   fungsi part 1Materi kuliah 18   fungsi part 1
Materi kuliah 18 fungsi part 1
 
Tugas sp algo
Tugas sp algoTugas sp algo
Tugas sp algo
 
Desain Top Down
Desain Top DownDesain Top Down
Desain Top Down
 
Materi kuliah 18 fungsi part 1
Materi kuliah 18   fungsi part 1Materi kuliah 18   fungsi part 1
Materi kuliah 18 fungsi part 1
 
Pertemuan vi (Function Java)
Pertemuan vi (Function Java)Pertemuan vi (Function Java)
Pertemuan vi (Function Java)
 
Laporan praktikum modul vi
Laporan praktikum modul viLaporan praktikum modul vi
Laporan praktikum modul vi
 
Modul pd
Modul pdModul pd
Modul pd
 
Cara membuat fungsi dan prosedur pada java
Cara membuat fungsi dan prosedur pada javaCara membuat fungsi dan prosedur pada java
Cara membuat fungsi dan prosedur pada java
 
Pertemuan 12
Pertemuan 12Pertemuan 12
Pertemuan 12
 
Function c++
Function c++Function c++
Function c++
 
5 adp fungsi & rekursi
5   adp fungsi & rekursi5   adp fungsi & rekursi
5 adp fungsi & rekursi
 
5.adp fungsi & rekursi
5.adp fungsi & rekursi5.adp fungsi & rekursi
5.adp fungsi & rekursi
 
5 adp fungsi & rekursi
5   adp fungsi & rekursi5   adp fungsi & rekursi
5 adp fungsi & rekursi
 
5 adp fungsi & rekursi
5   adp fungsi & rekursi5   adp fungsi & rekursi
5 adp fungsi & rekursi
 
5 adp fungsi & rekursi
5   adp fungsi & rekursi5   adp fungsi & rekursi
5 adp fungsi & rekursi
 
4. pemrograman fungsi
4. pemrograman fungsi4. pemrograman fungsi
4. pemrograman fungsi
 
Pertemuan 11 Fungsi (Function)
Pertemuan 11 Fungsi (Function)Pertemuan 11 Fungsi (Function)
Pertemuan 11 Fungsi (Function)
 

More from Evert Sandye Taasiringan (11)

04 if-ifelse-switch-break
04 if-ifelse-switch-break04 if-ifelse-switch-break
04 if-ifelse-switch-break
 
05 for-dowhile-while
05 for-dowhile-while05 for-dowhile-while
05 for-dowhile-while
 
06 nested
06 nested06 nested
06 nested
 
02 01-elemen
02 01-elemen02 01-elemen
02 01-elemen
 
02 02-operasi
02 02-operasi02 02-operasi
02 02-operasi
 
01 pseudocode
01 pseudocode01 pseudocode
01 pseudocode
 
01 algoritma
01 algoritma01 algoritma
01 algoritma
 
01 02-pseudocode
01 02-pseudocode01 02-pseudocode
01 02-pseudocode
 
Introductory maths analysis chapter 08 official
Introductory maths analysis   chapter 08 officialIntroductory maths analysis   chapter 08 official
Introductory maths analysis chapter 08 official
 
Pertemuan ke 1
Pertemuan ke 1Pertemuan ke 1
Pertemuan ke 1
 
Manajemen operasional ringkasan uas
Manajemen operasional ringkasan uas Manajemen operasional ringkasan uas
Manajemen operasional ringkasan uas
 

Recently uploaded

ppt-modul-6-pend-seni-di sd kelompok 2 ppt
ppt-modul-6-pend-seni-di sd kelompok 2 pptppt-modul-6-pend-seni-di sd kelompok 2 ppt
ppt-modul-6-pend-seni-di sd kelompok 2 pptArkhaRega1
 
Kontribusi Islam Dalam Pengembangan Peradaban Dunia - KELOMPOK 1.pptx
Kontribusi Islam Dalam Pengembangan Peradaban Dunia - KELOMPOK 1.pptxKontribusi Islam Dalam Pengembangan Peradaban Dunia - KELOMPOK 1.pptx
Kontribusi Islam Dalam Pengembangan Peradaban Dunia - KELOMPOK 1.pptxssuser50800a
 
Pendidikan-Bahasa-Indonesia-di-SD MODUL 3 .pptx
Pendidikan-Bahasa-Indonesia-di-SD MODUL 3 .pptxPendidikan-Bahasa-Indonesia-di-SD MODUL 3 .pptx
Pendidikan-Bahasa-Indonesia-di-SD MODUL 3 .pptxdeskaputriani1
 
RENCANA + Link2 Materi Pelatihan/BimTek "PTK 007 Rev-5 Thn 2023 (PENGADAAN) &...
RENCANA + Link2 Materi Pelatihan/BimTek "PTK 007 Rev-5 Thn 2023 (PENGADAAN) &...RENCANA + Link2 Materi Pelatihan/BimTek "PTK 007 Rev-5 Thn 2023 (PENGADAAN) &...
RENCANA + Link2 Materi Pelatihan/BimTek "PTK 007 Rev-5 Thn 2023 (PENGADAAN) &...Kanaidi ken
 
REFLEKSI MANDIRI_Prakarsa Perubahan BAGJA Modul 1.3.pdf
REFLEKSI MANDIRI_Prakarsa Perubahan BAGJA Modul 1.3.pdfREFLEKSI MANDIRI_Prakarsa Perubahan BAGJA Modul 1.3.pdf
REFLEKSI MANDIRI_Prakarsa Perubahan BAGJA Modul 1.3.pdfirwanabidin08
 
Latsol TWK Nasionalisme untuk masuk CPNS
Latsol TWK Nasionalisme untuk masuk CPNSLatsol TWK Nasionalisme untuk masuk CPNS
Latsol TWK Nasionalisme untuk masuk CPNSdheaprs
 
Modul Ajar Pendidikan Pancasila Kelas 5 Fase C
Modul Ajar Pendidikan Pancasila Kelas 5 Fase CModul Ajar Pendidikan Pancasila Kelas 5 Fase C
Modul Ajar Pendidikan Pancasila Kelas 5 Fase CAbdiera
 
Perumusan Visi dan Prakarsa Perubahan.pptx
Perumusan Visi dan Prakarsa Perubahan.pptxPerumusan Visi dan Prakarsa Perubahan.pptx
Perumusan Visi dan Prakarsa Perubahan.pptxadimulianta1
 
PELAKSANAAN + Link2 Materi BimTek _PTK 007 Rev-5 Thn 2023 (PENGADAAN) & Perhi...
PELAKSANAAN + Link2 Materi BimTek _PTK 007 Rev-5 Thn 2023 (PENGADAAN) & Perhi...PELAKSANAAN + Link2 Materi BimTek _PTK 007 Rev-5 Thn 2023 (PENGADAAN) & Perhi...
PELAKSANAAN + Link2 Materi BimTek _PTK 007 Rev-5 Thn 2023 (PENGADAAN) & Perhi...Kanaidi ken
 
Keterampilan menyimak kelas bawah tugas UT
Keterampilan menyimak kelas bawah tugas UTKeterampilan menyimak kelas bawah tugas UT
Keterampilan menyimak kelas bawah tugas UTIndraAdm
 
MODUL 1 Pembelajaran Kelas Rangkap-compressed.pdf
MODUL 1 Pembelajaran Kelas Rangkap-compressed.pdfMODUL 1 Pembelajaran Kelas Rangkap-compressed.pdf
MODUL 1 Pembelajaran Kelas Rangkap-compressed.pdfNurulHikmah50658
 
PEMANASAN GLOBAL - MATERI KELAS X MA.pptx
PEMANASAN GLOBAL - MATERI KELAS X MA.pptxPEMANASAN GLOBAL - MATERI KELAS X MA.pptx
PEMANASAN GLOBAL - MATERI KELAS X MA.pptxsukmakarim1998
 
Refleksi Mandiri Modul 1.3 - KANVAS BAGJA.pptx.pptx
Refleksi Mandiri Modul 1.3 - KANVAS BAGJA.pptx.pptxRefleksi Mandiri Modul 1.3 - KANVAS BAGJA.pptx.pptx
Refleksi Mandiri Modul 1.3 - KANVAS BAGJA.pptx.pptxIrfanAudah1
 
Sosialisasi PPDB SulSel tahun 2024 di Sulawesi Selatan
Sosialisasi PPDB SulSel tahun 2024 di Sulawesi SelatanSosialisasi PPDB SulSel tahun 2024 di Sulawesi Selatan
Sosialisasi PPDB SulSel tahun 2024 di Sulawesi Selatanssuser963292
 
PPT Penjumlahan Bersusun Kelas 1 Sekolah Dasar
PPT Penjumlahan Bersusun Kelas 1 Sekolah DasarPPT Penjumlahan Bersusun Kelas 1 Sekolah Dasar
PPT Penjumlahan Bersusun Kelas 1 Sekolah Dasarrenihartanti
 
Modul Projek - Batik Ecoprint - Fase B.pdf
Modul Projek  - Batik Ecoprint - Fase B.pdfModul Projek  - Batik Ecoprint - Fase B.pdf
Modul Projek - Batik Ecoprint - Fase B.pdfanitanurhidayah51
 
PELAKSANAAN + Link-Link MATERI Training_ "Effective INVENTORY & WAREHOUSING M...
PELAKSANAAN + Link-Link MATERI Training_ "Effective INVENTORY & WAREHOUSING M...PELAKSANAAN + Link-Link MATERI Training_ "Effective INVENTORY & WAREHOUSING M...
PELAKSANAAN + Link-Link MATERI Training_ "Effective INVENTORY & WAREHOUSING M...Kanaidi ken
 
aksi nyata penyebaran pemahaman merdeka belajar
aksi nyata penyebaran pemahaman merdeka belajaraksi nyata penyebaran pemahaman merdeka belajar
aksi nyata penyebaran pemahaman merdeka belajarHafidRanggasi
 
2 KISI-KISI Ujian Sekolah Dasar mata pelajaranPPKn 2024.pdf
2 KISI-KISI Ujian Sekolah Dasar  mata pelajaranPPKn 2024.pdf2 KISI-KISI Ujian Sekolah Dasar  mata pelajaranPPKn 2024.pdf
2 KISI-KISI Ujian Sekolah Dasar mata pelajaranPPKn 2024.pdfsdn3jatiblora
 
MATEMATIKA EKONOMI MATERI ANUITAS DAN NILAI ANUITAS
MATEMATIKA EKONOMI MATERI ANUITAS DAN NILAI ANUITASMATEMATIKA EKONOMI MATERI ANUITAS DAN NILAI ANUITAS
MATEMATIKA EKONOMI MATERI ANUITAS DAN NILAI ANUITASbilqisizzati
 

Recently uploaded (20)

ppt-modul-6-pend-seni-di sd kelompok 2 ppt
ppt-modul-6-pend-seni-di sd kelompok 2 pptppt-modul-6-pend-seni-di sd kelompok 2 ppt
ppt-modul-6-pend-seni-di sd kelompok 2 ppt
 
Kontribusi Islam Dalam Pengembangan Peradaban Dunia - KELOMPOK 1.pptx
Kontribusi Islam Dalam Pengembangan Peradaban Dunia - KELOMPOK 1.pptxKontribusi Islam Dalam Pengembangan Peradaban Dunia - KELOMPOK 1.pptx
Kontribusi Islam Dalam Pengembangan Peradaban Dunia - KELOMPOK 1.pptx
 
Pendidikan-Bahasa-Indonesia-di-SD MODUL 3 .pptx
Pendidikan-Bahasa-Indonesia-di-SD MODUL 3 .pptxPendidikan-Bahasa-Indonesia-di-SD MODUL 3 .pptx
Pendidikan-Bahasa-Indonesia-di-SD MODUL 3 .pptx
 
RENCANA + Link2 Materi Pelatihan/BimTek "PTK 007 Rev-5 Thn 2023 (PENGADAAN) &...
RENCANA + Link2 Materi Pelatihan/BimTek "PTK 007 Rev-5 Thn 2023 (PENGADAAN) &...RENCANA + Link2 Materi Pelatihan/BimTek "PTK 007 Rev-5 Thn 2023 (PENGADAAN) &...
RENCANA + Link2 Materi Pelatihan/BimTek "PTK 007 Rev-5 Thn 2023 (PENGADAAN) &...
 
REFLEKSI MANDIRI_Prakarsa Perubahan BAGJA Modul 1.3.pdf
REFLEKSI MANDIRI_Prakarsa Perubahan BAGJA Modul 1.3.pdfREFLEKSI MANDIRI_Prakarsa Perubahan BAGJA Modul 1.3.pdf
REFLEKSI MANDIRI_Prakarsa Perubahan BAGJA Modul 1.3.pdf
 
Latsol TWK Nasionalisme untuk masuk CPNS
Latsol TWK Nasionalisme untuk masuk CPNSLatsol TWK Nasionalisme untuk masuk CPNS
Latsol TWK Nasionalisme untuk masuk CPNS
 
Modul Ajar Pendidikan Pancasila Kelas 5 Fase C
Modul Ajar Pendidikan Pancasila Kelas 5 Fase CModul Ajar Pendidikan Pancasila Kelas 5 Fase C
Modul Ajar Pendidikan Pancasila Kelas 5 Fase C
 
Perumusan Visi dan Prakarsa Perubahan.pptx
Perumusan Visi dan Prakarsa Perubahan.pptxPerumusan Visi dan Prakarsa Perubahan.pptx
Perumusan Visi dan Prakarsa Perubahan.pptx
 
PELAKSANAAN + Link2 Materi BimTek _PTK 007 Rev-5 Thn 2023 (PENGADAAN) & Perhi...
PELAKSANAAN + Link2 Materi BimTek _PTK 007 Rev-5 Thn 2023 (PENGADAAN) & Perhi...PELAKSANAAN + Link2 Materi BimTek _PTK 007 Rev-5 Thn 2023 (PENGADAAN) & Perhi...
PELAKSANAAN + Link2 Materi BimTek _PTK 007 Rev-5 Thn 2023 (PENGADAAN) & Perhi...
 
Keterampilan menyimak kelas bawah tugas UT
Keterampilan menyimak kelas bawah tugas UTKeterampilan menyimak kelas bawah tugas UT
Keterampilan menyimak kelas bawah tugas UT
 
MODUL 1 Pembelajaran Kelas Rangkap-compressed.pdf
MODUL 1 Pembelajaran Kelas Rangkap-compressed.pdfMODUL 1 Pembelajaran Kelas Rangkap-compressed.pdf
MODUL 1 Pembelajaran Kelas Rangkap-compressed.pdf
 
PEMANASAN GLOBAL - MATERI KELAS X MA.pptx
PEMANASAN GLOBAL - MATERI KELAS X MA.pptxPEMANASAN GLOBAL - MATERI KELAS X MA.pptx
PEMANASAN GLOBAL - MATERI KELAS X MA.pptx
 
Refleksi Mandiri Modul 1.3 - KANVAS BAGJA.pptx.pptx
Refleksi Mandiri Modul 1.3 - KANVAS BAGJA.pptx.pptxRefleksi Mandiri Modul 1.3 - KANVAS BAGJA.pptx.pptx
Refleksi Mandiri Modul 1.3 - KANVAS BAGJA.pptx.pptx
 
Sosialisasi PPDB SulSel tahun 2024 di Sulawesi Selatan
Sosialisasi PPDB SulSel tahun 2024 di Sulawesi SelatanSosialisasi PPDB SulSel tahun 2024 di Sulawesi Selatan
Sosialisasi PPDB SulSel tahun 2024 di Sulawesi Selatan
 
PPT Penjumlahan Bersusun Kelas 1 Sekolah Dasar
PPT Penjumlahan Bersusun Kelas 1 Sekolah DasarPPT Penjumlahan Bersusun Kelas 1 Sekolah Dasar
PPT Penjumlahan Bersusun Kelas 1 Sekolah Dasar
 
Modul Projek - Batik Ecoprint - Fase B.pdf
Modul Projek  - Batik Ecoprint - Fase B.pdfModul Projek  - Batik Ecoprint - Fase B.pdf
Modul Projek - Batik Ecoprint - Fase B.pdf
 
PELAKSANAAN + Link-Link MATERI Training_ "Effective INVENTORY & WAREHOUSING M...
PELAKSANAAN + Link-Link MATERI Training_ "Effective INVENTORY & WAREHOUSING M...PELAKSANAAN + Link-Link MATERI Training_ "Effective INVENTORY & WAREHOUSING M...
PELAKSANAAN + Link-Link MATERI Training_ "Effective INVENTORY & WAREHOUSING M...
 
aksi nyata penyebaran pemahaman merdeka belajar
aksi nyata penyebaran pemahaman merdeka belajaraksi nyata penyebaran pemahaman merdeka belajar
aksi nyata penyebaran pemahaman merdeka belajar
 
2 KISI-KISI Ujian Sekolah Dasar mata pelajaranPPKn 2024.pdf
2 KISI-KISI Ujian Sekolah Dasar  mata pelajaranPPKn 2024.pdf2 KISI-KISI Ujian Sekolah Dasar  mata pelajaranPPKn 2024.pdf
2 KISI-KISI Ujian Sekolah Dasar mata pelajaranPPKn 2024.pdf
 
MATEMATIKA EKONOMI MATERI ANUITAS DAN NILAI ANUITAS
MATEMATIKA EKONOMI MATERI ANUITAS DAN NILAI ANUITASMATEMATIKA EKONOMI MATERI ANUITAS DAN NILAI ANUITAS
MATEMATIKA EKONOMI MATERI ANUITAS DAN NILAI ANUITAS
 

07 function 2

  • 2. Modular Programming Sebuah program yang besar dibagi menjadi sejumlah modul kecil (function). Setiap function mengerjakan tugas tertentu. Keuntungan: Rancangan Top down dengan pendekatan divide dan conquer. Dapat dikerjakan dalam tim Lebih mudah mengalkasikan kesalahan Modifikasi dapat dilakukan tanpa menganggu program secara keseluruhan Mempermudah dokumentasi
  • 3. Function Standard library function, adalah fungsi funsi standard yang sudah disediakan oleh C. Untuk menggunakannya kita harus mencantumkan header file dari fungsi tersebut. (dengan perintah #include) Programmer / User Define Function, adalah fungsi yang dibuat oleh programmer untuk digunakan dalam program yang dibuat.
  • 4. Standard Library Function Contoh : #include <stdio.h> Beberapa fungsi yang terdapat dalam stdio.h : printf() scanf() getchar() gets() puts()
  • 5. Programmer-Defined Function Dalam merancang sebuah function harus diperhatikan sbb: INPUT (data apa yang akan menjadi masukkan fungsi) PROSES (bagaimana algoritma yang akan digunakan dalam fungsi tersebut) OUTPUT (informasi apa yang akan dikembalikan oleh fungsi kepada si pemanggil) PROSES INPUT OUTPUT
  • 6. Programmer-Defined Function Penulisan fungsi dibagi atas : Protototype (pendeklarasikan fungsi) yaitu kepala atau judul fungsi (sebagai pengenal fungsi). Definition yaitu penulisan fungsi secara lengkap. Contoh : int luas(int p, int l); // prototype // definition int luas(int p, int l) { return p*l; }
  • 7. Contoh Penggunaan Fungsi // Contoh Fungsi #include <stdio.h> #include <conio.h> int penjumlahan(int a, int b) { int r; r=a+b; return (r); } int main() { int z; z=penjumlahan(5,3); printf("Hasil penjumlahan = %d",z); return 0; }
  • 8. Penjelasan Fungsi Ketika program dieksekusi, yang dijalankan pertama kali adalah fungsi main(). Terlihat jelas bahwa dalam main() terdapat variable z dengan tipe data integer. Setelah itu, fungsi penjumlahan dipanggil. Maka akan terdapat proses pertukaran data sebagai berikut: int penjumlahan(int a, int b) z = penjumlahan ( 5 , 3 );
  • 9. Penjelasan Fungsi Maka setelah terjadi pengisian nilai, variable a akan terisi dengan nilai 5 dan variable b akan terisi dengan nilai 3. Fungsi penjumlahan mendeklarasikan sebuah variable baru lagi (int r;) dan kemudian menjumlahkan nilai r=a+b; dengan hasil akhir variable r = 8. return (r); merupakan pengakhir fungsi penjumlahan dan memberikan hasil akhir nilai r kepada fungsi yang memanggilnya (dalam hal ini fungsi main()). Proses pengembalian nilai dapat digambarkan sebagai berikut: int penjumlahan(int a, int b) 8 z = penjumlahan ( 5 , 3 ); Nilai 8 hasil dari fungsi dikembalikan ke pemanggilnya.
  • 10. END