SlideShare ist ein Scribd-Unternehmen logo
1 von 79
Two Dimensional
Array
Pengertian array dua dimensi
Array dua dimensi dapat dipandang sebagai gabungan array satu dimensi
Pandanglah tiga buah array satu dimensi yang dibuat dengan int A1[5], int
A2[5], int A3[5].
Ketiga buah array satu dimensi diatas, dapat digabung menjadi satu, sehingga
terbentuk sebuah array yang disebut array dua dimensi yang biasanya
diilustrasikan sebagai berikut :
Array 1 Dimensi :
char A[5] ;
Array 2 Dimensi :
char A[3][5] ;
Isinya ada
Tapi tidak diketahui
Isinya ada
Tapi tidak diketahui
Array 1 Dimensi :
char A[5] ;
0 1 2 3
4
Array 2 Dimensi :
char A[3][5] ;
0 1 2 3
4
0
1
2
Jumlah
kolom
( column )
Jumlah kolom
Jumlah baris
( row )
Nomor
Kolom
( index )
Nomor
kolom
Nomor
baris
Array 1 Dimensi :
char A[5] ;
0 1 2 3
4
Array 2 Dimensi :
char A[3][5] ;
0 1 2 3
4
0
1
2
Jumlah kolom
Jumlah kolom
Jumlah baris
Nomor
kolom
Nomor
kolom
Nomor
baris
Isinya ada
Tapi tidak diketahui
Isinya ada
Tapi tidak diketahui
Array 2 Dimensi :
char A[3][5]
;
Sering disebut
array 3 x 5
Array 1 Dimensi :
char A[5] =
{‘A’,’B’,’C’,’D’,’E’} ;
A B C D E
0 1 2 3
4
Array 2 Dimensi :
char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’ ,
‘K’,’L’,’M’,’N’,’O } ;
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
Array
2 Dimensi
Contoh - 1
#include<stdio.h>
void main()
{ char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
printf(" %c ", A[1][2] );
}
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
baris : 1
kolom : 2
Dev C++ 5.11
Contoh - 1
#include<stdio.h>
void main()
{ char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
printf(" %c ", A[1][2] );
}
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
H
Dev C++ 5.11
Array 2 Dimensi :
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
Dev C++ 5.11
H
#include<stdio.h>
void main()
{ char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
printf(" %c ", A[1][2] );
}
#include<stdio.h>
void main()
{ char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
printf(" %c ", A[1][2] );
}
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
DIULANG
Apa yang tercetak ?
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
printf(" %c ", A[1][2] );
}
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
H
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
printf(" %c ", A[2][3] );
}
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
Apa yang tercetak ?
Kalau ini : ?
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
printf(" %c ", A[1][2] );
}
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
N
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
printf(" %c ", A[3][2] );
}
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
Apa yang tercetak ?
Kalau ini : ?
3
Apakah
Error ?
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
printf(" %c ", A[3][2] );
}
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
. Tercetak karakter
sembarang sesuai
dengan karakter
apa yang ada pada
lokasi tersebut saat itu
TIDAK
ERROR
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
char A[3][5];
A[0][0]
A[0][2]
A[1][3]
?
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
char A[3][5];
A[0][0]
A[0][2]
A[1][3]
A[2][1]
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
char A[3][5];
A[0][0]
A[0][2]
A[1][3]
A[2][1]
0 1 2 3
4
A B C D E
F G H I J
K L M N 0
0
1
2
char A[3][5];
i j
0 0
0 1
0 2
0 3
0 4
1 0
1 1
1 2
1 3
1 4
2 0
2 1
2 2
2 3
2 4
i
j
i j
0 0
1
2
3
4
1 0
1
2
3
4
2 0
1
2
3
4
Array 2 Dimensi :
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
Logical
illustration
3 baris
5 kolom
A B C D E
0,0 0,1 0,2 0,3 0,4 1,0 1,1 1,2 1,3 1,4 2,0 2,1 2,2 2,3 2,4
F G H I J K L M N 0
memory physical allocation
secara fisik alamatnya contiguous
2,4
untuk
menyatakan
A[2][4]
Array 2 Dimensi :
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
char A[3][5] = { 'A', 'B', 'C', 'D', 'E', 'F',
'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N',
'O' } ;
char A[3][5] = { 'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H', 'I', 'J',
'K', 'L',
'M', 'N', 'O' } ;
atau :
atau :
char A[3][5] = { ‘A’,’B’,’C’,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,
} ;
A B C 0 0
0 1 2 3
4
F G H I J
K L 0 0 0
0
1
2
0 (NULL)
0 0 0 0 0 0 0 0
Karakter NULL
semua bit-nya 0 (nol)
Kalau dicetak dengan ;
“ %c ” tercetak : spasi (blank
“ %i “ tercetak : 0 (nol)
“ %x “ tercetak : 00
A 0 0 0 0
0 1 2 3
4
0 0 0 0 0
0 0 0 0 0
0
1
2
char A[3][5] = { ‘A’
} ;
char A[3][5] = { 65
} ;
atau :
atau :
char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’
,
‘F’,’G’,’H’,’I’,’J’ ,
‘K’,’L’,’0’,’N’,’O’ } ;
0 1 2 3
4
A B C D E
F G H I J
K L 0 N 0
0
1
2
NULL
char A[3][5] = { "ABCDE" ,
"FGHIJ"
,
"KL
NO" } ;
0 1 2 3
4
A B C D E
F G H I J
K L N 0
0
1
2
space
space
0 0 0 0 0 0 0 0
Karakter NULL
Kalau dicetak dengan :
“ %c ” tercetak : spasi (blank)
“ %i “ tercetak : 0 (nol)
“ %x“ tercetak : 00
0 0 1 0 0 0 0 0
Karakter space
Kalau dicetak dengan ;
“ %c ” tercetak : spasi (blank)
“ %i “ tercetak : 32
“ %x “ tercetak : 20
Contoh - 2
Contoh - 2
#include<stdio.h>
main()
{ int A[3][5] =
{ 5,12,17,10,7,
15,6,25,2,19,
4,9,20,22,11 };
printf(" %c ", A[1][2] );
return 0;
}
0 1 2 3
4
5 12 17 10 7
15 6 25 2 19
4 9 20 22 11
0
1
2
Dev C++ 5.11
Apa yang tercetak : ?
Contoh - 2
#include<stdio.h>
void main()
{ int A[3][5] =
{ 5,12,17,10,7,
15,6,25,2,19,
4,9,20,22,11 };
printf(" %c ", A[1][2] );
}
0 1 2 3
4
5 12 17 10 7
15 6 25 2 19
4 9 20 22 11
0
1
2
Dev C++ 5.11
25
int A[3][5] =
{ 5,12,17,10,7,
15,6,25,2,19,
4,9,20,22,11 };
int A[3][5] = { 5,12,17,10,7,
15,6,25,2,19,
4,9,20,22,11 };
int A[3][5] = { 5,12,17,10,7, 15,6,25,2,19,
4,9,20,
22,11 };
int A[3][5] = { 5,12,17,10,7, 15,6,25,2,19,
0 1 2 3
4
5 12 17 10 7
15 6 25 2 19
4 9 20 22 11
0
1
2
atau :
atau :
atau :
int A[3][5] = { 5,12,17,10,7,
15,6,25,
2,19,4,9,
20,
22,11 };
atau :
int A[3][5] =
{ 5,12,17,10,7,
15,6,25,2,19,
4,9, } ;
0 1 2 3
4
5 12 17 10 7
15 6 25 2 19
4 9 0 0 0
0
1
2
Lokasi yang
tidak diisi,
otomatis diisi
dengan 0 (nol)
Hanya diisi
12 elemen
3 elemen
terakhir
tidak diisi
int A[3][5] =
{ 5,12,17,10,7,
15,6,25,2,19,
4,9, } ;
0 1 2 3
4
5 12 17 10 7
15 6 25 2 19
4 9 0 0 0
0
1
2
int A[3][5] = { 1, 2, 3, 4, 5,
6, 7, 8,
9,10,
11,12,13,14,15,16 } ;
ERROR
maksimu
m 15
elemen
Contoh - 3
Dev C++ 5.11
#include<stdio.h>
void main()
{char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int j;
j=2;
{ printf( "%c ", A[0] [ j ] );
}
}
Apa yang tercetak : ?
Contoh – 3a
Borland Turbo-C++ A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int j;
j=2;
{ printf( "%c ", A[0] [ j ] );
}
}
Apa yang tercetak : ?
Contoh – 3a
Borland Turbo-C++ A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int j;
j=2;
{ printf( "%c ", A[0] [ j ] );
}
}
Contoh – 3a
C
Contoh - 4
Dev C++ 5.11
#include<stdio.h>
void main()
{char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int j;
for( j=0; j<=4; j++ )
{ printf( "%c ", A[0] [ j ] );
}
}
Apa yang tercetak : ?
Contoh – 4
Dev C++ 5.11 A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int j;
for( j=0; j<=4; j++ )
{ printf( "%c ", A[0] [ j ] );
}
}Apa yang tercetak : ?
Contoh – 4
j
elemen
yang isinya
dicetak
0
1
2
3
4
A[0][0]
A[0][1]
A[0][2]
A[0][3]
A[0][4]
Dev C++ 5.11 A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int j;
for( j=0; j<=4; j++ )
{ printf( "%c ", A[0] [ j ] );
}
}
Contoh – 4
j
elemen
yang isinya
dicetak
0
1
2
3
4
A[0][0]
A[0][1]
A[0][2]
A[0][3]
A[0][4]
A B C D E
Dev C++ 5.11
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int j;
for( …………………… )
{ …………………………… );
}
}A B C D E
Contoh – 4
Tulis ulang !
supaya tercetak :
A B C D E
Contoh - 5
#include<stdio.h>
void main( )
{char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’
,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i;
for( i=0; i<=2; i++ )
{ printf( "%c ", A[i][0]);
}
}
Dev C++ 5.11
Contoh - 5
Apa yang tercetak : ?
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
#include<stdio.h>
void main( )
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i;
for( i=0; i<=2; i++ )
{ printf( "%c ", A[i][0]);
}
}
Dev C++ 5.11
Contoh - 5
Apa yang tercetak : ?
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
#include<stdio.h>
void main( )
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i;
for( i=0; i<=2; i++ )
{ printf( "%c ", A[i][0]);
}
}
Dev C++ 5.11
Contoh - 5
i
elemen
yang isinya
dicetak
0
1
2
A[0][0]
A[1][0]
A[2][0]
Apa yang tercetak : ?
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
#include<stdio.h>
void main( )
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i;
for( i=0; i<=2; i++ )
{ printf( "%c ", A[i][0]);
}
} A F K
Borland Turbo-C++
Contoh - 5
i
elemen
yang isinya
dicetak
0
1
2
A[0][0]
A[1][0]
A[2][0]
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
#include<stdio.h>
void main( )
char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i;
for( ……………………)
{ ……………………………..);
}
}
Borland Turbo-C++
Contoh - 5
i
elemen
yang isinya
dicetak
0
1
2
A[0][0]
A[1][0]
A[2][0]Tulis ulang !
supaya tercetak :
A F K
Contoh - 6
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for( i=0; i<=2; i++ )
{ for( j=0; j<=4; j++)
{ printf("%c ", A[i][j]);
}
printf("n");
}
}
Dev C++ 5.11Contoh - 6
Apa yang tercetak : ?
Tulis !
Apa yang
tercetak
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for( i=0; i<=2; i++ )
{ for( j=0; j<=4; j++)
{ printf("%c ", A[i][j]);
}
printf("n");
}
}
Dev C++ 5.11Contoh - 6
Apa yang tercetak : ?
i j
0 1
2
3
4
1 1
2
3
4
2 1
2
3
4
#include<stdio.h>
void main()
{char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for( i=0; i<=2; i++ )
{ for( j=0; j<=4; j++)
{ printf("%c ", A[i][j]);
}
printf("n");
}
}
Dev C++ 5.11Contoh - 6
Apa yang tercetak : ?
i j
0 0
1
2
3
4
1 0
1
2
3
4
2 0
1
2
3
4
urutan
proses
#include<stdio.h>
void main()
{ char A[3][5]={ "ABCDE" ,
"FGHIJ" ,
"KLMNO" };
int i, j;
for( i=0; i<=2; i++ )
{ for( j=0; j<=4; j++)
{ printf("%c ", A[i][j]);
}
printf("n");
}
}
Borland Turbo-C++Contoh - 6
Apa yang tercetak : ?
i j
0 0
1
2
3
4
1 0
1
2
3
4
2 0
1
2
3
4
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for( i=0; i<=2; i++ )
{ for( j=0; j<=4; j++)
{ printf("%c ", A[i][j]);
}
printf("n");
}
}
Borland Turbo-C++Contoh - 6
Apa yang tercetak : ?
i j
0 0
1
2
3
4
1 0
1
2
3
4
2 0
1
2
3
4
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
Tercetak :
A B C D E
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for( i=0; i<=2; i++ )
{ for( j=0; j<=4; j++)
{ printf("%c ", A[i][j]);
}
printf("n");
}
}
Borland Turbo-C++Contoh - 6
Apa yang tercetak : ?
i j
0 0
1
2
3
4
1 0
1
2
3
4
2 0
1
2
3
4
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
Tercetak :
F G H I J
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for( i=0; i<=2; i++ )
{ for( j=0; j<=4; j++)
{ printf("%c ", A[i][j]);
}
printf("n");
}
}
Borland Turbo-C++Contoh - 6
Apa yang tercetak : ?
i j
0 0
1
2
3
4
1 0
1
2
3
4
2 0
1
2
3
4
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
Tercetak :
K L M N O
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for( i=0; i<=2; i++ )
{ for( j=0; j<=4; j++)
{ printf("%c ", A[i][j]);
}
printf("n");
}
}
Borland Turbo-C++Contoh - 6
Apa yang tercetak : ?
i j
0 0
1
2
3
4
1 0
1
2
3
4
2 0
1
2
3
4
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
Tercetak :
A B C D E
F G H I J
K L M N O
#include<stdio.h>
void main()
char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for( i=0; i<=2; i++ )
{ for( j=0; j<=4; j++)
{ printf("%c ", A[i][j]);
}
printf("n");
}
}
Borland Turbo-C++Contoh - 6
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
A B C D E
F G H I J
K L M N O
i j
0 0
1
2
3
4
1 0
1
2
3
4
2 0
1
2
3
4
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for(………………… )
{ for( …………………….)
{…………………………);
}
printf("n");
}
}
Borland Turbo-C++Contoh - 6
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
i j
0 0
1
2
3
4
1 0
1
2
3
4
2 0
1
2
3
4
Tulis ulang,
untuk mencetak :
ABC D E
FGH I J
KLMNO
Contoh - 7
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for(j=0; j<=4; j++ )
{ for( i=0; i<=2; i++)
{ printf("%c",A[ i][ j ]);
}
printf("n");
}
}
Apa yang tercetak : ?
Tulis !
Apa yang
tercetak
#include<stdio.h>
void main()
{char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’
,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for(j=0; j<=4; j++ )
{ for( i=0; i<=2; i++)
{ printf("%c",A[ i][ j ]);
}
printf("n");
}
}Apa yang tercetak : ?
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
j
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for(j=0; j<=4; j++ )
{ for( i=0; i<=2; i++)
{ printf("%c",A[ i][ j ]);
}
printf("n");
}
}
j i
0
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
j
0
1
2
1 0
1
2
2 0
1
2
3 0
1
2
4 0
1
2
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for(j=0; j<=4; j++ )
{ for( i=0; i<=2; i++)
{ printf("%c",A[ i][ j ]);
}
printf("n");
}
}
j i
0
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
j
0
1
2
1 0
1
2
2 0
1
2
3 0
1
2
4 0
1
2
urutan
proses
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for(j=0; j<=4; j++ )
{ for( i=0; i<=2; i++)
{ printf("%c",A[ i][ j ]);
}
printf("n");
}
}
j i
0 0
1
2
1 0
1
2
2 0
1
2
3 0
1
2
4 0
1
2
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
j
Tercetak :
A F K
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for(j=0; j<=4; j++ )
{ for( i=0; i<=2; i++)
{ printf("%c",A[ i][ j ]);
}
printf("n");
}
}
j i
0 0
1
2
1 0
1
2
2 0
1
2
3 0
1
2
4 0
1
2
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
j
Tercetak :
B G L
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for(j=0; j<=4; j++ )
{ for( i=0; i<=2; i++)
{ printf("%c",A[ i][ j ]);
}
printf("n");
}
}
j i
0 0
1
2
1 0
1
2
2 0
1
2
3 0
1
2
4 0
1
2
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
j
Tercetak :
C H M
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for(j=0; j<=4; j++ )
{ for( i=0; i<=2; i++)
{ printf("%c",A[ i][ j ]);
}
printf("n");
}
}
j i
0 0
1
2
1 0
1
2
2 0
1
2
3 0
1
2
4 0
1
2
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
j
Tercetak :
D I N
#include<stdio.h>
void main()
{char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for(j=0; j<=4; j++ )
{ for( i=0; i<=2; i++)
{ printf("%c",A[ i][ j ]);
}
printf("n");
}
}
j i
0 0
1
2
1 0
1
2
2 0
1
2
3 0
1
2
4 0
1
2
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
j
Tercetak :
E J O
#include<stdio.h>
void main()
char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for(j=0; j<=4; j++ )
{ for( i=0; i<=2; i++)
{ printf("%c",A[ i][ j ]);
}
printf("n");
}
}
j i
0 0
1
2
1 0
1
2
2 0
1
2
3 0
1
2
4 0
1
2
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
j
AF K
BGL
CHM
D I N
EJ O
Tercetak :
A F K
B G L
C H M
D I N
E J O
#include<stdio.h>
void main()
char A[3][5] =
{ ‘A’,’B’,’C’,’D’,’E’ ,
‘F’,’G’,’H’,’I’,’J’,
‘K’,’L’,’M’,’N’,’O’ } ;
int i, j;
for(j=0; j<=4; j++ )
{ for( i=0; i<=2; i++)
{ printf("%c",A[ i][ j ]);
}
printf("n");
}
}
j i
0 0
1
2
1 0
1
2
2 0
1
2
3 0
1
2
4 0
1
2
A B C D E
0 1 2 3
4
F G H I J
K L M N 0
0
1
2
i
j
[ 0 ] [ 0 ]
[ 1 ] [ 0 ]
[ 2 ] [ 0 ]
[ 0 ] [ 1 ]
[ 1 ] [ 1 ]
[ 2 ] [ 1 ]
[ 0 ] [ 2 ]
[ 1 ] [ 2 ]
[ 2 ] [ 2 ]
[ 0 ] [ 3 ]
[ 1 ] [ 3 ]
[ 2 ] [ 3 ]
[ 0 ] [ 4 ]
[ 1 ] [ 4 ]
[ 2 ] [ 4 ]
[ 0 ] [ 0 ]
[ 1 ] [ 0 ]
[ 2 ] [ 0 ]
[ 0 ] [ 1 ]
[ 1 ] [ 1 ]
[ 2 ] [ 1 ]
----
----
[ 2 ] [ 4 ]
A F K
BG L
CHM
D I N
EJ O
Pertemuan 1 - Algoritma dan Struktur Data 1

Weitere ähnliche Inhalte

Was ist angesagt?

Contoh peyelesaian logika fuzzy
Contoh peyelesaian logika fuzzyContoh peyelesaian logika fuzzy
Contoh peyelesaian logika fuzzy
Zaenal Khayat
 
Centralizers, normalizers, center, stabilizers
Centralizers, normalizers, center, stabilizersCentralizers, normalizers, center, stabilizers
Centralizers, normalizers, center, stabilizers
wahyuhenky
 
Metode numerik [rifqi.ikhwanuddin.com]
Metode numerik [rifqi.ikhwanuddin.com]Metode numerik [rifqi.ikhwanuddin.com]
Metode numerik [rifqi.ikhwanuddin.com]
Tri Jayanti
 
Materi 4. type, nama & harga
Materi 4. type, nama & hargaMateri 4. type, nama & harga
Materi 4. type, nama & harga
Melva Amma Kalian
 
Pertemuan 02 teori dasar himpunan
Pertemuan 02   teori dasar himpunanPertemuan 02   teori dasar himpunan
Pertemuan 02 teori dasar himpunan
Fajar Istiqomah
 

Was ist angesagt? (20)

Finite State Automata - Materi 3 - TBO
Finite State Automata - Materi 3 - TBOFinite State Automata - Materi 3 - TBO
Finite State Automata - Materi 3 - TBO
 
membuat function dalam mysql
membuat function dalam mysqlmembuat function dalam mysql
membuat function dalam mysql
 
10. konsep enkapsulasi
10. konsep enkapsulasi10. konsep enkapsulasi
10. konsep enkapsulasi
 
Contoh peyelesaian logika fuzzy
Contoh peyelesaian logika fuzzyContoh peyelesaian logika fuzzy
Contoh peyelesaian logika fuzzy
 
Centralizers, normalizers, center, stabilizers
Centralizers, normalizers, center, stabilizersCentralizers, normalizers, center, stabilizers
Centralizers, normalizers, center, stabilizers
 
Pertemuan 1 konsep dasar pemrograman berorientasi objek
Pertemuan 1 konsep dasar pemrograman berorientasi objekPertemuan 1 konsep dasar pemrograman berorientasi objek
Pertemuan 1 konsep dasar pemrograman berorientasi objek
 
8 Data Record
8 Data Record8 Data Record
8 Data Record
 
Analisis Perancangan Kerja
Analisis Perancangan KerjaAnalisis Perancangan Kerja
Analisis Perancangan Kerja
 
Pertemuan 6 Struktur Data, Algoritma dan Pemrograman
Pertemuan 6 Struktur Data, Algoritma dan PemrogramanPertemuan 6 Struktur Data, Algoritma dan Pemrograman
Pertemuan 6 Struktur Data, Algoritma dan Pemrograman
 
Analisis Algoritma - Strategi Algoritma Greedy
Analisis Algoritma - Strategi Algoritma GreedyAnalisis Algoritma - Strategi Algoritma Greedy
Analisis Algoritma - Strategi Algoritma Greedy
 
Metode numerik [rifqi.ikhwanuddin.com]
Metode numerik [rifqi.ikhwanuddin.com]Metode numerik [rifqi.ikhwanuddin.com]
Metode numerik [rifqi.ikhwanuddin.com]
 
Materi 7. array
Materi 7. arrayMateri 7. array
Materi 7. array
 
Analisis Algoritma - Kelas-kelas Dasar Efisiensi Algoritma
Analisis Algoritma - Kelas-kelas Dasar Efisiensi AlgoritmaAnalisis Algoritma - Kelas-kelas Dasar Efisiensi Algoritma
Analisis Algoritma - Kelas-kelas Dasar Efisiensi Algoritma
 
Tutorial penggunaan big query
Tutorial penggunaan big queryTutorial penggunaan big query
Tutorial penggunaan big query
 
Analisis cluster
Analisis clusterAnalisis cluster
Analisis cluster
 
TEKNIK ENKRIPSI DAN DEKRIPSI HILL CIPHER
TEKNIK ENKRIPSI DAN DEKRIPSI HILL CIPHERTEKNIK ENKRIPSI DAN DEKRIPSI HILL CIPHER
TEKNIK ENKRIPSI DAN DEKRIPSI HILL CIPHER
 
Topik 8 Perulangan
Topik 8 PerulanganTopik 8 Perulangan
Topik 8 Perulangan
 
Webinar PHP-ID: Mari Mengenal Logika Fuzzy (Fuzzy Logic)
Webinar PHP-ID: Mari Mengenal Logika Fuzzy (Fuzzy Logic)Webinar PHP-ID: Mari Mengenal Logika Fuzzy (Fuzzy Logic)
Webinar PHP-ID: Mari Mengenal Logika Fuzzy (Fuzzy Logic)
 
Materi 4. type, nama & harga
Materi 4. type, nama & hargaMateri 4. type, nama & harga
Materi 4. type, nama & harga
 
Pertemuan 02 teori dasar himpunan
Pertemuan 02   teori dasar himpunanPertemuan 02   teori dasar himpunan
Pertemuan 02 teori dasar himpunan
 

Andere mochten auch

Presentasi fordis kkp skripsi genap 1314 (pra sidang)
Presentasi fordis kkp skripsi genap 1314 (pra sidang)Presentasi fordis kkp skripsi genap 1314 (pra sidang)
Presentasi fordis kkp skripsi genap 1314 (pra sidang)
Achmad Solichin
 
Makalah seminar nasional matematika 2012 pgri
Makalah seminar nasional matematika 2012 pgriMakalah seminar nasional matematika 2012 pgri
Makalah seminar nasional matematika 2012 pgri
arya0809
 

Andere mochten auch (16)

Seminar: PHP Developer for Dummies
Seminar: PHP Developer for DummiesSeminar: PHP Developer for Dummies
Seminar: PHP Developer for Dummies
 
Presentasi fordis kkp skripsi genap 1314 (pra sidang)
Presentasi fordis kkp skripsi genap 1314 (pra sidang)Presentasi fordis kkp skripsi genap 1314 (pra sidang)
Presentasi fordis kkp skripsi genap 1314 (pra sidang)
 
5 Tahun Membuat Pesawat Kertas
5 Tahun Membuat Pesawat Kertas5 Tahun Membuat Pesawat Kertas
5 Tahun Membuat Pesawat Kertas
 
Pertemuan 4 - Struktur Kondisi IF
Pertemuan 4 - Struktur Kondisi IFPertemuan 4 - Struktur Kondisi IF
Pertemuan 4 - Struktur Kondisi IF
 
Seminar: Mau jadi Android User atau Developer?
Seminar: Mau jadi Android User atau Developer?Seminar: Mau jadi Android User atau Developer?
Seminar: Mau jadi Android User atau Developer?
 
Pertemuan 5 - Struktur Kondisi IF (lanjutan)
Pertemuan 5 - Struktur Kondisi IF (lanjutan)Pertemuan 5 - Struktur Kondisi IF (lanjutan)
Pertemuan 5 - Struktur Kondisi IF (lanjutan)
 
Quickstrat bootstrap
Quickstrat bootstrapQuickstrat bootstrap
Quickstrat bootstrap
 
Modern PHP Developer
Modern PHP DeveloperModern PHP Developer
Modern PHP Developer
 
Chapter 01 - Introduction to Computers
Chapter 01 - Introduction to ComputersChapter 01 - Introduction to Computers
Chapter 01 - Introduction to Computers
 
Makalah seminar nasional matematika 2012 pgri
Makalah seminar nasional matematika 2012 pgriMakalah seminar nasional matematika 2012 pgri
Makalah seminar nasional matematika 2012 pgri
 
Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
 
Digital marketing — an overview
Digital marketing — an overviewDigital marketing — an overview
Digital marketing — an overview
 
What's it like being a Woman in Tech?
What's it like being a Woman in Tech?What's it like being a Woman in Tech?
What's it like being a Woman in Tech?
 
Working With Big Data
Working With Big DataWorking With Big Data
Working With Big Data
 
Privacy is an Illusion and you’re all losers! - Cryptocow - Infosecurity 2013
Privacy is an Illusion and you’re all losers! - Cryptocow - Infosecurity 2013Privacy is an Illusion and you’re all losers! - Cryptocow - Infosecurity 2013
Privacy is an Illusion and you’re all losers! - Cryptocow - Infosecurity 2013
 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with Data
 

Mehr von Achmad Solichin

Mehr von Achmad Solichin (20)

Kuliah Umum - Tips Publikasi Jurnal SINTA untuk Mahasiswa Galau (6 Agustus 2022)
Kuliah Umum - Tips Publikasi Jurnal SINTA untuk Mahasiswa Galau (6 Agustus 2022)Kuliah Umum - Tips Publikasi Jurnal SINTA untuk Mahasiswa Galau (6 Agustus 2022)
Kuliah Umum - Tips Publikasi Jurnal SINTA untuk Mahasiswa Galau (6 Agustus 2022)
 
Materi Webinar Web 3.0 (16 Juli 2022)
Materi Webinar Web 3.0 (16 Juli 2022)Materi Webinar Web 3.0 (16 Juli 2022)
Materi Webinar Web 3.0 (16 Juli 2022)
 
Webinar: Kesadaran Keamanan Informasi (3 Desember 2021)
Webinar: Kesadaran Keamanan Informasi (3 Desember 2021)Webinar: Kesadaran Keamanan Informasi (3 Desember 2021)
Webinar: Kesadaran Keamanan Informasi (3 Desember 2021)
 
Webinar PHP-ID: Machine Learning dengan PHP
Webinar PHP-ID: Machine Learning dengan PHPWebinar PHP-ID: Machine Learning dengan PHP
Webinar PHP-ID: Machine Learning dengan PHP
 
Webinar Data Mining dengan Rapidminer | Universitas Budi Luhur
Webinar Data Mining dengan Rapidminer | Universitas Budi LuhurWebinar Data Mining dengan Rapidminer | Universitas Budi Luhur
Webinar Data Mining dengan Rapidminer | Universitas Budi Luhur
 
TREN DAN IDE RISET BIDANG DATA MINING TERBARU
TREN DAN IDE RISET BIDANG DATA MINING TERBARUTREN DAN IDE RISET BIDANG DATA MINING TERBARU
TREN DAN IDE RISET BIDANG DATA MINING TERBARU
 
Metodologi Riset: Literature Review
Metodologi Riset: Literature ReviewMetodologi Riset: Literature Review
Metodologi Riset: Literature Review
 
Materi Seminar: Artificial Intelligence dengan PHP
Materi Seminar: Artificial Intelligence dengan PHPMateri Seminar: Artificial Intelligence dengan PHP
Materi Seminar: Artificial Intelligence dengan PHP
 
Percobaan Perpindahan Kalor melalui Konduksi, Konveksi dan Radiasi
Percobaan Perpindahan Kalor melalui Konduksi, Konveksi dan RadiasiPercobaan Perpindahan Kalor melalui Konduksi, Konveksi dan Radiasi
Percobaan Perpindahan Kalor melalui Konduksi, Konveksi dan Radiasi
 
Metodologi Riset: Literature Review
Metodologi Riset: Literature ReviewMetodologi Riset: Literature Review
Metodologi Riset: Literature Review
 
Depth First Search (DFS) pada Graph
Depth First Search (DFS) pada GraphDepth First Search (DFS) pada Graph
Depth First Search (DFS) pada Graph
 
Breadth First Search (BFS) pada Graph
Breadth First Search (BFS) pada GraphBreadth First Search (BFS) pada Graph
Breadth First Search (BFS) pada Graph
 
Binary Search Tree (BST) - Algoritma dan Struktur Data
Binary Search Tree (BST) - Algoritma dan Struktur DataBinary Search Tree (BST) - Algoritma dan Struktur Data
Binary Search Tree (BST) - Algoritma dan Struktur Data
 
Computer Vision di Era Industri 4.0
Computer Vision di Era Industri 4.0Computer Vision di Era Industri 4.0
Computer Vision di Era Industri 4.0
 
Seminar: Become a Reliable Web Programmer
Seminar: Become a Reliable Web ProgrammerSeminar: Become a Reliable Web Programmer
Seminar: Become a Reliable Web Programmer
 
The Big 5: Future IT Trends
The Big 5: Future IT TrendsThe Big 5: Future IT Trends
The Big 5: Future IT Trends
 
Sharing Penelitian S3 Lab Elins FMIPA UGM - 17 Februari 2016
Sharing Penelitian S3 Lab Elins FMIPA UGM - 17 Februari 2016Sharing Penelitian S3 Lab Elins FMIPA UGM - 17 Februari 2016
Sharing Penelitian S3 Lab Elins FMIPA UGM - 17 Februari 2016
 
Workshop PHP: Laporan HTML, Excel, PDF
Workshop PHP: Laporan HTML, Excel, PDFWorkshop PHP: Laporan HTML, Excel, PDF
Workshop PHP: Laporan HTML, Excel, PDF
 
Pertemuan 07. File dan Direktori
Pertemuan 07. File dan DirektoriPertemuan 07. File dan Direktori
Pertemuan 07. File dan Direktori
 
Pertemuan 06. String dan Tanggal
Pertemuan 06. String dan TanggalPertemuan 06. String dan Tanggal
Pertemuan 06. String dan Tanggal
 

Pertemuan 1 - Algoritma dan Struktur Data 1

  • 1.
  • 3. Pengertian array dua dimensi Array dua dimensi dapat dipandang sebagai gabungan array satu dimensi Pandanglah tiga buah array satu dimensi yang dibuat dengan int A1[5], int A2[5], int A3[5]. Ketiga buah array satu dimensi diatas, dapat digabung menjadi satu, sehingga terbentuk sebuah array yang disebut array dua dimensi yang biasanya diilustrasikan sebagai berikut :
  • 4. Array 1 Dimensi : char A[5] ; Array 2 Dimensi : char A[3][5] ; Isinya ada Tapi tidak diketahui Isinya ada Tapi tidak diketahui
  • 5. Array 1 Dimensi : char A[5] ; 0 1 2 3 4 Array 2 Dimensi : char A[3][5] ; 0 1 2 3 4 0 1 2 Jumlah kolom ( column ) Jumlah kolom Jumlah baris ( row ) Nomor Kolom ( index ) Nomor kolom Nomor baris
  • 6. Array 1 Dimensi : char A[5] ; 0 1 2 3 4 Array 2 Dimensi : char A[3][5] ; 0 1 2 3 4 0 1 2 Jumlah kolom Jumlah kolom Jumlah baris Nomor kolom Nomor kolom Nomor baris Isinya ada Tapi tidak diketahui Isinya ada Tapi tidak diketahui
  • 7. Array 2 Dimensi : char A[3][5] ; Sering disebut array 3 x 5
  • 8. Array 1 Dimensi : char A[5] = {‘A’,’B’,’C’,’D’,’E’} ; A B C D E 0 1 2 3 4 Array 2 Dimensi : char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’ , ‘K’,’L’,’M’,’N’,’O } ; A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2
  • 11. #include<stdio.h> void main() { char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; printf(" %c ", A[1][2] ); } 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 baris : 1 kolom : 2 Dev C++ 5.11 Contoh - 1
  • 12. #include<stdio.h> void main() { char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; printf(" %c ", A[1][2] ); } 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 H Dev C++ 5.11
  • 13. Array 2 Dimensi : 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 Dev C++ 5.11 H #include<stdio.h> void main() { char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; printf(" %c ", A[1][2] ); }
  • 14. #include<stdio.h> void main() { char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; printf(" %c ", A[1][2] ); } 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 DIULANG Apa yang tercetak ?
  • 15. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; printf(" %c ", A[1][2] ); } 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 H
  • 16. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; printf(" %c ", A[2][3] ); } 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 Apa yang tercetak ? Kalau ini : ?
  • 17. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; printf(" %c ", A[1][2] ); } 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 N
  • 18. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; printf(" %c ", A[3][2] ); } 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 Apa yang tercetak ? Kalau ini : ? 3 Apakah Error ?
  • 19. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; printf(" %c ", A[3][2] ); } 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 . Tercetak karakter sembarang sesuai dengan karakter apa yang ada pada lokasi tersebut saat itu TIDAK ERROR
  • 20. 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 char A[3][5]; A[0][0] A[0][2] A[1][3] ?
  • 21. 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 char A[3][5]; A[0][0] A[0][2] A[1][3] A[2][1]
  • 22. 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 char A[3][5]; A[0][0] A[0][2] A[1][3] A[2][1]
  • 23.
  • 24. 0 1 2 3 4 A B C D E F G H I J K L M N 0 0 1 2 char A[3][5]; i j 0 0 0 1 0 2 0 3 0 4 1 0 1 1 1 2 1 3 1 4 2 0 2 1 2 2 2 3 2 4 i j i j 0 0 1 2 3 4 1 0 1 2 3 4 2 0 1 2 3 4
  • 25. Array 2 Dimensi : A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; Logical illustration 3 baris 5 kolom A B C D E 0,0 0,1 0,2 0,3 0,4 1,0 1,1 1,2 1,3 1,4 2,0 2,1 2,2 2,3 2,4 F G H I J K L M N 0 memory physical allocation secara fisik alamatnya contiguous 2,4 untuk menyatakan A[2][4]
  • 26. Array 2 Dimensi : A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 char A[3][5] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O' } ; char A[3][5] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O' } ; atau : atau :
  • 27. char A[3][5] = { ‘A’,’B’,’C’, ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’, } ; A B C 0 0 0 1 2 3 4 F G H I J K L 0 0 0 0 1 2 0 (NULL) 0 0 0 0 0 0 0 0 Karakter NULL semua bit-nya 0 (nol) Kalau dicetak dengan ; “ %c ” tercetak : spasi (blank “ %i “ tercetak : 0 (nol) “ %x “ tercetak : 00
  • 28. A 0 0 0 0 0 1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 1 2 char A[3][5] = { ‘A’ } ; char A[3][5] = { 65 } ; atau : atau :
  • 29. char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’ , ‘K’,’L’,’0’,’N’,’O’ } ; 0 1 2 3 4 A B C D E F G H I J K L 0 N 0 0 1 2 NULL
  • 30. char A[3][5] = { "ABCDE" , "FGHIJ" , "KL NO" } ; 0 1 2 3 4 A B C D E F G H I J K L N 0 0 1 2 space space
  • 31.
  • 32. 0 0 0 0 0 0 0 0 Karakter NULL Kalau dicetak dengan : “ %c ” tercetak : spasi (blank) “ %i “ tercetak : 0 (nol) “ %x“ tercetak : 00 0 0 1 0 0 0 0 0 Karakter space Kalau dicetak dengan ; “ %c ” tercetak : spasi (blank) “ %i “ tercetak : 32 “ %x “ tercetak : 20
  • 34. Contoh - 2 #include<stdio.h> main() { int A[3][5] = { 5,12,17,10,7, 15,6,25,2,19, 4,9,20,22,11 }; printf(" %c ", A[1][2] ); return 0; } 0 1 2 3 4 5 12 17 10 7 15 6 25 2 19 4 9 20 22 11 0 1 2 Dev C++ 5.11 Apa yang tercetak : ?
  • 35. Contoh - 2 #include<stdio.h> void main() { int A[3][5] = { 5,12,17,10,7, 15,6,25,2,19, 4,9,20,22,11 }; printf(" %c ", A[1][2] ); } 0 1 2 3 4 5 12 17 10 7 15 6 25 2 19 4 9 20 22 11 0 1 2 Dev C++ 5.11 25
  • 36. int A[3][5] = { 5,12,17,10,7, 15,6,25,2,19, 4,9,20,22,11 }; int A[3][5] = { 5,12,17,10,7, 15,6,25,2,19, 4,9,20,22,11 }; int A[3][5] = { 5,12,17,10,7, 15,6,25,2,19, 4,9,20, 22,11 }; int A[3][5] = { 5,12,17,10,7, 15,6,25,2,19, 0 1 2 3 4 5 12 17 10 7 15 6 25 2 19 4 9 20 22 11 0 1 2 atau : atau : atau : int A[3][5] = { 5,12,17,10,7, 15,6,25, 2,19,4,9, 20, 22,11 }; atau :
  • 37. int A[3][5] = { 5,12,17,10,7, 15,6,25,2,19, 4,9, } ; 0 1 2 3 4 5 12 17 10 7 15 6 25 2 19 4 9 0 0 0 0 1 2 Lokasi yang tidak diisi, otomatis diisi dengan 0 (nol) Hanya diisi 12 elemen 3 elemen terakhir tidak diisi
  • 38. int A[3][5] = { 5,12,17,10,7, 15,6,25,2,19, 4,9, } ; 0 1 2 3 4 5 12 17 10 7 15 6 25 2 19 4 9 0 0 0 0 1 2 int A[3][5] = { 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14,15,16 } ; ERROR maksimu m 15 elemen
  • 40. Dev C++ 5.11 #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int j; j=2; { printf( "%c ", A[0] [ j ] ); } } Apa yang tercetak : ? Contoh – 3a
  • 41. Borland Turbo-C++ A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int j; j=2; { printf( "%c ", A[0] [ j ] ); } } Apa yang tercetak : ? Contoh – 3a
  • 42. Borland Turbo-C++ A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int j; j=2; { printf( "%c ", A[0] [ j ] ); } } Contoh – 3a C
  • 44. Dev C++ 5.11 #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int j; for( j=0; j<=4; j++ ) { printf( "%c ", A[0] [ j ] ); } } Apa yang tercetak : ? Contoh – 4
  • 45. Dev C++ 5.11 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int j; for( j=0; j<=4; j++ ) { printf( "%c ", A[0] [ j ] ); } }Apa yang tercetak : ? Contoh – 4 j elemen yang isinya dicetak 0 1 2 3 4 A[0][0] A[0][1] A[0][2] A[0][3] A[0][4]
  • 46. Dev C++ 5.11 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int j; for( j=0; j<=4; j++ ) { printf( "%c ", A[0] [ j ] ); } } Contoh – 4 j elemen yang isinya dicetak 0 1 2 3 4 A[0][0] A[0][1] A[0][2] A[0][3] A[0][4] A B C D E
  • 47. Dev C++ 5.11 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int j; for( …………………… ) { …………………………… ); } }A B C D E Contoh – 4 Tulis ulang ! supaya tercetak : A B C D E
  • 48.
  • 50. #include<stdio.h> void main( ) {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i; for( i=0; i<=2; i++ ) { printf( "%c ", A[i][0]); } } Dev C++ 5.11 Contoh - 5 Apa yang tercetak : ?
  • 51. A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 #include<stdio.h> void main( ) {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i; for( i=0; i<=2; i++ ) { printf( "%c ", A[i][0]); } } Dev C++ 5.11 Contoh - 5 Apa yang tercetak : ?
  • 52. A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 #include<stdio.h> void main( ) {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i; for( i=0; i<=2; i++ ) { printf( "%c ", A[i][0]); } } Dev C++ 5.11 Contoh - 5 i elemen yang isinya dicetak 0 1 2 A[0][0] A[1][0] A[2][0] Apa yang tercetak : ?
  • 53. A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 #include<stdio.h> void main( ) {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i; for( i=0; i<=2; i++ ) { printf( "%c ", A[i][0]); } } A F K Borland Turbo-C++ Contoh - 5 i elemen yang isinya dicetak 0 1 2 A[0][0] A[1][0] A[2][0]
  • 54. A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 #include<stdio.h> void main( ) char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i; for( ……………………) { ……………………………..); } } Borland Turbo-C++ Contoh - 5 i elemen yang isinya dicetak 0 1 2 A[0][0] A[1][0] A[2][0]Tulis ulang ! supaya tercetak : A F K
  • 55.
  • 57. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for( i=0; i<=2; i++ ) { for( j=0; j<=4; j++) { printf("%c ", A[i][j]); } printf("n"); } } Dev C++ 5.11Contoh - 6 Apa yang tercetak : ? Tulis ! Apa yang tercetak
  • 58. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for( i=0; i<=2; i++ ) { for( j=0; j<=4; j++) { printf("%c ", A[i][j]); } printf("n"); } } Dev C++ 5.11Contoh - 6 Apa yang tercetak : ? i j 0 1 2 3 4 1 1 2 3 4 2 1 2 3 4
  • 59. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for( i=0; i<=2; i++ ) { for( j=0; j<=4; j++) { printf("%c ", A[i][j]); } printf("n"); } } Dev C++ 5.11Contoh - 6 Apa yang tercetak : ? i j 0 0 1 2 3 4 1 0 1 2 3 4 2 0 1 2 3 4 urutan proses
  • 60. #include<stdio.h> void main() { char A[3][5]={ "ABCDE" , "FGHIJ" , "KLMNO" }; int i, j; for( i=0; i<=2; i++ ) { for( j=0; j<=4; j++) { printf("%c ", A[i][j]); } printf("n"); } } Borland Turbo-C++Contoh - 6 Apa yang tercetak : ? i j 0 0 1 2 3 4 1 0 1 2 3 4 2 0 1 2 3 4 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i
  • 61. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for( i=0; i<=2; i++ ) { for( j=0; j<=4; j++) { printf("%c ", A[i][j]); } printf("n"); } } Borland Turbo-C++Contoh - 6 Apa yang tercetak : ? i j 0 0 1 2 3 4 1 0 1 2 3 4 2 0 1 2 3 4 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i Tercetak : A B C D E
  • 62. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for( i=0; i<=2; i++ ) { for( j=0; j<=4; j++) { printf("%c ", A[i][j]); } printf("n"); } } Borland Turbo-C++Contoh - 6 Apa yang tercetak : ? i j 0 0 1 2 3 4 1 0 1 2 3 4 2 0 1 2 3 4 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i Tercetak : F G H I J
  • 63. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for( i=0; i<=2; i++ ) { for( j=0; j<=4; j++) { printf("%c ", A[i][j]); } printf("n"); } } Borland Turbo-C++Contoh - 6 Apa yang tercetak : ? i j 0 0 1 2 3 4 1 0 1 2 3 4 2 0 1 2 3 4 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i Tercetak : K L M N O
  • 64. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for( i=0; i<=2; i++ ) { for( j=0; j<=4; j++) { printf("%c ", A[i][j]); } printf("n"); } } Borland Turbo-C++Contoh - 6 Apa yang tercetak : ? i j 0 0 1 2 3 4 1 0 1 2 3 4 2 0 1 2 3 4 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i Tercetak : A B C D E F G H I J K L M N O
  • 65. #include<stdio.h> void main() char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for( i=0; i<=2; i++ ) { for( j=0; j<=4; j++) { printf("%c ", A[i][j]); } printf("n"); } } Borland Turbo-C++Contoh - 6 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i A B C D E F G H I J K L M N O i j 0 0 1 2 3 4 1 0 1 2 3 4 2 0 1 2 3 4
  • 66. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for(………………… ) { for( …………………….) {…………………………); } printf("n"); } } Borland Turbo-C++Contoh - 6 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i i j 0 0 1 2 3 4 1 0 1 2 3 4 2 0 1 2 3 4 Tulis ulang, untuk mencetak : ABC D E FGH I J KLMNO
  • 68. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for(j=0; j<=4; j++ ) { for( i=0; i<=2; i++) { printf("%c",A[ i][ j ]); } printf("n"); } } Apa yang tercetak : ? Tulis ! Apa yang tercetak
  • 69. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for(j=0; j<=4; j++ ) { for( i=0; i<=2; i++) { printf("%c",A[ i][ j ]); } printf("n"); } }Apa yang tercetak : ? A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i j
  • 70. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for(j=0; j<=4; j++ ) { for( i=0; i<=2; i++) { printf("%c",A[ i][ j ]); } printf("n"); } } j i 0 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i j 0 1 2 1 0 1 2 2 0 1 2 3 0 1 2 4 0 1 2
  • 71. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for(j=0; j<=4; j++ ) { for( i=0; i<=2; i++) { printf("%c",A[ i][ j ]); } printf("n"); } } j i 0 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i j 0 1 2 1 0 1 2 2 0 1 2 3 0 1 2 4 0 1 2 urutan proses
  • 72. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for(j=0; j<=4; j++ ) { for( i=0; i<=2; i++) { printf("%c",A[ i][ j ]); } printf("n"); } } j i 0 0 1 2 1 0 1 2 2 0 1 2 3 0 1 2 4 0 1 2 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i j Tercetak : A F K
  • 73. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for(j=0; j<=4; j++ ) { for( i=0; i<=2; i++) { printf("%c",A[ i][ j ]); } printf("n"); } } j i 0 0 1 2 1 0 1 2 2 0 1 2 3 0 1 2 4 0 1 2 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i j Tercetak : B G L
  • 74. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for(j=0; j<=4; j++ ) { for( i=0; i<=2; i++) { printf("%c",A[ i][ j ]); } printf("n"); } } j i 0 0 1 2 1 0 1 2 2 0 1 2 3 0 1 2 4 0 1 2 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i j Tercetak : C H M
  • 75. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for(j=0; j<=4; j++ ) { for( i=0; i<=2; i++) { printf("%c",A[ i][ j ]); } printf("n"); } } j i 0 0 1 2 1 0 1 2 2 0 1 2 3 0 1 2 4 0 1 2 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i j Tercetak : D I N
  • 76. #include<stdio.h> void main() {char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for(j=0; j<=4; j++ ) { for( i=0; i<=2; i++) { printf("%c",A[ i][ j ]); } printf("n"); } } j i 0 0 1 2 1 0 1 2 2 0 1 2 3 0 1 2 4 0 1 2 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i j Tercetak : E J O
  • 77. #include<stdio.h> void main() char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for(j=0; j<=4; j++ ) { for( i=0; i<=2; i++) { printf("%c",A[ i][ j ]); } printf("n"); } } j i 0 0 1 2 1 0 1 2 2 0 1 2 3 0 1 2 4 0 1 2 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i j AF K BGL CHM D I N EJ O Tercetak : A F K B G L C H M D I N E J O
  • 78. #include<stdio.h> void main() char A[3][5] = { ‘A’,’B’,’C’,’D’,’E’ , ‘F’,’G’,’H’,’I’,’J’, ‘K’,’L’,’M’,’N’,’O’ } ; int i, j; for(j=0; j<=4; j++ ) { for( i=0; i<=2; i++) { printf("%c",A[ i][ j ]); } printf("n"); } } j i 0 0 1 2 1 0 1 2 2 0 1 2 3 0 1 2 4 0 1 2 A B C D E 0 1 2 3 4 F G H I J K L M N 0 0 1 2 i j [ 0 ] [ 0 ] [ 1 ] [ 0 ] [ 2 ] [ 0 ] [ 0 ] [ 1 ] [ 1 ] [ 1 ] [ 2 ] [ 1 ] [ 0 ] [ 2 ] [ 1 ] [ 2 ] [ 2 ] [ 2 ] [ 0 ] [ 3 ] [ 1 ] [ 3 ] [ 2 ] [ 3 ] [ 0 ] [ 4 ] [ 1 ] [ 4 ] [ 2 ] [ 4 ] [ 0 ] [ 0 ] [ 1 ] [ 0 ] [ 2 ] [ 0 ] [ 0 ] [ 1 ] [ 1 ] [ 1 ] [ 2 ] [ 1 ] ---- ---- [ 2 ] [ 4 ] A F K BG L CHM D I N EJ O