11 Array_2.pdf - [email protected] Pendahuluan Variabel bertipe data dasar hanya dapat memuat 1 data saja \u25e6 Contoh A integer A hanya dapat

11 Array_2.pdf - [email protected] Pendahuluan...

This preview shows page 1 - 7 out of 23 pages.

Image of page 1
Pendahuluan Variabel bertipe data dasar hanya dapat memuat 1 data saja Contoh: A: integer A hanya dapat memuat satu bilangan bulat saja Bagaimana jika kita harus memproses sekumpulan data yang bertipe sama? Hasil ujian 100 mahasiswa Tabel harga barang di swalayan a 1 , a 2 , a 3 , …, a n
Image of page 2
Pendahuluan Sekumpulan data yang bertipe sama tersebut perlu disimpan sementara dalam memory untuk diproses Bagaimana caranya? Apakah kita perlu membuat variabel satu-satu untuk masing-masing data? nilai1, nilai2, nilai3, …, nilai100 : integer (???) Tidak efektif
Image of page 3
Array (Larik) Sekumpulan data bertipe sama disimpan secara beruntun di memory komputer Setiap elemen data diacu dengan menggunakan indeks Indeks menunjukkan posisi data relatif dalam array Indeks harus bertipe data yang memiliki keterurutan, seperti: integer atau karakter
Image of page 4
Array Contoh Array A, berisi 8 buah elemen data bertipe integer. A 0 158 1 157 2 162 3 169 4 172 5 155 6 170 7 163 Indeks Elemen pertama: A[0] nilainya 158 Elemen kedua: A[1] nilainya 157 . . . Elemen kedelapan: A[7] nilainya 163
Image of page 5
Deklarasi Array Array merupakan struktur data statis jumlah elemen array harus sudah diketahui sebelum program dieksekusi Ukuran array tidak dapat diubah selama program dijalankan Sebelum digunakan, array harus dideklarasikan terlebih dahulu
Image of page 6
Image of page 7

You've reached the end of your free preview.

Want to read all 23 pages?

  • Spring '19
  • adi

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors