Chinaunix首页 | 论坛 | 博客
  • 博客访问: 196997
  • 博文数量: 77
  • 博客积分: 1749
  • 博客等级: 上尉
  • 技术积分: 810
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-28 18:27
文章分类
文章存档

2012年(28)

2011年(49)

分类: C/C++

2011-11-25 13:26:08

It means the same as a positive index: a[b] is equivalent to *(a + b),
so a[-1] is equivalent to *(a - 1)

If you have a pointer that points into an array (i.e. not at the first
element), a negative index is perfectly legal

eg.
int a[5] = {1, 2, 3, 4, 5};
int *b = a+3;
则 b[-1] = 3;
   b[-2] = 2;
阅读(1083) | 评论(0) | 转发(0) |
0

上一篇:【Backup】 const

下一篇:【Backup】make xconfig

给主人留下些什么吧!~~