指针的运算

//指针的运算仅对 PChar 类型
procedure TForm1.Button1Click(Sender: TObject);
var
  p: PChar;
begin
  p := 'China';
  Inc(p);
  p := p + 1;
  ShowMessage(p);  //返回:ina

  Dec(p);
  p := p - 1;
  ShowMessage(p);  //返回:China
end;

你可能感兴趣的:(指针的运算)