c语言全局变量符号,C语言中的 @ 符号是什么意思?

C语言中的 '@' 符号用于指定全局变量的绝对地址,常用于嵌入式系统中访问内存映射的I/O端口。通过 '@' 符号可以将变量绑定到特定内存地址,例如 'int glob @0x0500 = 10;',创建一个全局变量并初始化。但 '@' 符号不能用于函数或局部变量。
摘要由CSDN通过智能技术生成

标签:assign   inter   res   ted   访问内存   变量   出现   read_only   his

Global Variable Address Modifier (@address)

You can assign global variables to specific addresses with the global variable address modifier. These variables are called ‘absolute variables‘. They are useful for accessing memory mapped I/O ports and have the following syntax:

Declaration = [@|@""]

[= ];

is the type specifier, e.g., int, char

is the identifier of the global object, e.g., i, glob

is the absolute address of the object, e.g., 0xff04, 0x00+8

is the value to which the global variable is initialized.

A segment is created for each global object specified with an absolute address. This address must not be inside any address range in the SECTIONS entries of the link parameter file. Otherwise, there would be a linker error (overlapping segments). If the specified ad

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值