#include "iostream.h"
#include "conio.h"
void main()
{ static int tgl_lahir[] = { 13,9,1982 };
int *ptgl;
ptgl = tgl_lahir; /* ptgl berisi alamat array */
cout<<"Diakses dengan pointer\n";
cout<<"Tanggal = "<< *ptgl<<"\n";
cout<<"Bulan = "<< *(ptgl + 1) <<"\n";
cout<<"Tahun = "<<*(ptgl + 2) <<"\n";
cout<<"\nDiakses dengan array biasa\n";
cout<<"Tanggal = "<< tgl_lahir[0] <<"\n";
cout<<"Bulan = "<< tgl_lahir[1] <<"\n";
cout<<"Tahun = "<< tgl_lahir[2] <<"\n";
getch();
}
0 Response to "POINTER MENUNJUK SUATU ARRAY"
Posting Komentar