加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Delphi中@,^,#,$特殊符号意义

发布时间:2020-12-15 09:59:23 所属栏目:大数据 来源:网络整理
导读:概述: ? ? ^: 指针 ? ? @: 取址 ? ? #: 十进制符 ? ? $: 十六进制符 @:取址运算符; var ? ? int:integer; ? ? p:^integer; begin ? ? new(P); ? ? int:=24; ? ? p:=@int; ? ? dispose(P); end; ^:指针的引用解析操作符; var ? ? pint:^integer; begin ? ? n
概述:
? ?^: 指针
? ?@: 取址
? ?#: 十进制符
? ?$: 十六进制符

@:取址运算符;
var
? ?int:integer;
? ?p:^integer;
begin
? ?new(P);
? ?int:=24;
? ?p:=@int;
? ?dispose(P);
end;

^:指针的引用解析操作符;
var
? ?pint:^integer;
begin
? ?new(pint);
? ?showmessage(inttohex(integer(@pint),8));
? ?pint^:=$ff;
? ?showmessage(inttohex(pint^,4));
end;

#:ASCII码值表示符;
const
? ?tab_key=#9;//TAB键的ASCII值

符号 ^ 有两种用途,当它出现在类型标识符之前,如^typeName,表示一个类型,该类型表示指向typeName类型变量的指针;当它出现在指针变量之后,如pointer^,该符号对指针解除参照,也就是说,返回存储在内存地址(该地址保存在指针中)的值指针,指向的数据.
var
? ?I: Integer;
? ?PI: ?^Integer;?
begin
? ?I := 10
? ?PI := @I;;
? ?PI^ := 20;
? ?I := PI^;
end;

取指针的方法,比如y:=p^; 就是指为Y赋值指针P

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读