数组名访问数组元素

通过数组名访问数组元素

看下面代码:
int i, a[] = {3,4,5,6,7,3,7,4,4,6};
for (i = 0; i <= 9; i++)
{
   printf("%d\n", a[i]);
}
很显然,它是显示a 数组的各元素值。我们还可以这样访问元素,如下:
int i, a[] = {3,4,5,6,7,3,7,4,4,6};
for (i = 0; i <= 9; i++)
{
   printf("%d\n", *(a+i));
}

它的结果和作用完全一样。

http://my.pcbaby.com.cn/d/3440520.html

http://my.pcbaby.com.cn/d/3440523.html

http://my.pcbaby.com.cn/d/3440524.html

http://my.pcbaby.com.cn/d/3440525.html

http://my.pcbaby.com.cn/d/3440526.html

http://my.pcbaby.com.cn/d/3440528.html

http://my.pcbaby.com.cn/d/3440529.html

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/296602/

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/296689/

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/296734/

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/296734/

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/296842/

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/296842/

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/296958/

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/296997/

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/297068/

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/297110/

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/297156/

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/297190/

http://www.fmi.com.cn/index.php/MgrExample/detail/tid/297250/


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值