var
s:array[0..30] of char;
p:^char;
i:integer;
begin
s:='ddssds';
ShowMessage(s);
p:=@s;
for i:= 0 to strlen(s) do
begin
ShowMessage(p[i]);
inc(p);
end;
end;
为什么这样不能运行,好奇怪,
s:array[0..30] of char;
p:^char;
i:integer;
begin
s:='ddssds';
ShowMessage(s);
p:=@s;
for i:= 0 to strlen(s) do
begin
ShowMessage(p[i]);
inc(p);
end;
end;
为什么这样不能运行,好奇怪,
s:array[0..30] of char;
p:^char;
i:integer;
begin
s:= 'ddssds ';
ShowMessage(s);
p:=@s;
for i:= 0 to strlen(s) do
begin
//ShowMessage(p[i]);
ShowMessage(strpas(p));
inc(p);
end;
end;
var
s:array[0..30] of char;
p:^char;
i:integer;
begin
//s:= 'ddssds ';
fillchar(s,30,0);
move('ddssds ',s,7);
ShowMessage(s);
p:=@s;
for i:= 0 to strlen(s) do
begin
//ShowMessage(p[i]);
ShowMessage(strpas(PChar(p)));
inc(p);
end;
end;
s:array[0..30] of char;
p:^char;
i:integer;
begin
s:= 'ddssds ';
p:=@s;
for i:= 0 to strlen(s) do
begin
showmessage(string(p^));
inc(p);
end;
end;
楼上的编译可以通过,我以前把^p 当P^在那里使用了,竟然不报错,因为对DELPHI不熟,想靠便宜器提示才行,
int main()
{
char a[30]="adsdsds";
char * p = a;
for(int i = 0; i<=29; i++)
{
cout<<p[i]<<endl;
}
cin.get();
return 0;
}
这是我写的C++代码,是不是我把它转换成DELPHI的时候转换错了?