通过数组名访问数组元素
看下面代码: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/