pchar:类型是一个指向空字符结束的字符串
^char:是一个字符指针。是个指针,里面的内容是字符。
var
c
:string;
d
:pchar;
e
:^char;
f
:pchar;
g,g1:Pchar;
h
:^char;
i:integer;
begin
setlength(c,10);
for
i:=
1
to
2
do
begin
c[i]
:=
'a';
end;
f
:=
@c[1];
//仓库内容
g
:=
@c;
//门牌号
g1
:=pchar(c);
//仓库内容,同d一样
e
:=
@c[1];
//仓库
d
:=
@c[1];
//仓库内容
h
:=
@c;
showmessage(f);
//aa
showmessage(g);
//把g赋值的是指针地址,显示当然是乱码了,可以改为一下句,显示内容
showmessage(g1);
showmessage(e^);
//a
showmessage(d);
//aa
showmessage(d^);
//a
//
showmessage(h);
//错误
h,e是指针
不能按字符显示showmessage(IntToStr(integer(h)));
//
showmessage(e);
//错误
showmessage(c);
//aa
end;