mencoba pointer pascal,,
program coba_poiinter;
uses crt;
p,q :^integer;
a,b:integer;
begin
a:=20;
b:=30;
p:=@a;
p^:=15;
p:=@b;
p^:=a;
writeln('a = ',a,' b = ',b);
readln;
end.
nah kalo yang dibawah ini udah maenan yang lebih lagi..
hehehe
monggoh di jajal..
:D
program pointer;
uses crt;
type pointerstring = ^string;
var
p,q,r,s :pointerstring;
nilai :string;
begin
nilai :='ini adalah string nilai';
p:= @nilai;
new(q);
new(s);
q^:='ini adalah isi pointer';
r:=q;
s^:=q^;
writeln('alamat pointer p = ',
seg(p^):4,' : ',ofs(p^):4,' : ','isi pointer p : ',p^);
writeln('alamat pointer q = ',
seg(q^):4,' : ',ofs(q^):4,' : ','isi pointer p : ',q^);
writeln('alamat pointer r = ',
seg(r^):4,' : ',ofs(r^):4,' : ','isi pointer p : ',r^);
writeln('alamat pointer s = ',
seg(s^):4,' : ',ofs(s^):4,' : ','isi pointer p : ',s^);
readln;
end.
No comments:
Post a Comment