Source Code :
Program Pointer_tidak_bertipe;
Uses crt;
Var
p : Pointer;
q : ^Byte;
r : array [0..100] of Byte;
i,n : Byte;
Begin
Clrscr;
GetMem(p, 20);
q := p;
Write('Input angka : '); readln(n);
Clrscr;
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
Write('r[ ', i ,' ] = ', r[i], ': ');
Writeln('p^ ke-', i ,' = ', q^);
inc(q);
End;
Readln;
End.
|
Output :
1. Input angka.
2. Output pointer.
EmoticonEmoticon