Array dimensi dua tersusun dalam bentuk baris dan kolom, dimana indeks
pertama menunjukan baris dan indeks kedua menunjukan kolom.
pertama menunjukan baris dan indeks kedua menunjukan kolom.
contoh
#include <conio.h>
#include <iostream.h>
main()
{
char nama[3][4][10]=
{{"Pak","BU","Mas"},
{"Andi","Budi","Carli","imam"}};
clrscr();
cout<<nama[0][0]<<endl;
cout<<nama[1][3]<<endl;
getch();
}
#include <iostream.h>
main()
{
char nama[3][4][10]=
{{"Pak","BU","Mas"},
{"Andi","Budi","Carli","imam"}};
clrscr();
cout<<nama[0][0]<<endl;
cout<<nama[1][3]<<endl;
getch();
}
contoh2
#include <conio.h>
#include <iostream.h>
main()
{
char nama[3][4][10]=
{{"Pak","BU","Mas"},
{"Andi","Budi","Carli","imam"},
{"Sari","Sinta","Susi","Susan"}};
clrscr();
cout<<nama[0][1]<<endl;
cout<<nama[2][3]<<endl;
getch();
}
#include <iostream.h>
main()
{
char nama[3][4][10]=
{{"Pak","BU","Mas"},
{"Andi","Budi","Carli","imam"},
{"Sari","Sinta","Susi","Susan"}};
clrscr();
cout<<nama[0][1]<<endl;
cout<<nama[2][3]<<endl;
getch();
}