Contoh Program Pointer Tak Bertipe Pada Pascal
uses crt;
var
p : Pointer;
q : ^Byte;
r : array [0..100] of Byte;
i : Byte;
n : integer;
begin
clrscr;
write('Masukkan jumlah data : '); readln(n);
writeln;
writeln;
GetMem(p, 20);
q:=p;
for i:=0 to n do
begin
r[i]:=n-i;
q^:= n-i;
inc(q);
end;
q:=p;
for i:=0 to n do
begin
writeln(' ___________________________');
writeln('| | |');
writeln('| r[ ', i ,' ] = ', r[i], ' | p^ ke-', i ,' = ', q^, ' |');
writeln('|_____________|_____________|');
inc(q);
end;
readln;
end.
thx gan...sangat membantu (y)
BalasHapus