我是靠谱客的博主 搞怪菠萝,这篇文章主要介绍C语言数组特性-取下标运算中的交换律----i[a] == a[i],现在分享给大家,希望可以做个参考。





After the declaration and defination:
int a[] = {1,  2, 3,  4,  5 };
a + i equals i + a, they are pointers with the same value pointed to the array element a[i],
so a[i] = i[a],(0 <= i < 5)。

#include <stdio.h>
#include <stdlib.h>

int main(void){
   int a[] = {1, 2, 3, 4, 5};

   printf("After the declaration and defination int a[] = /{1, 2, 3, 4, 5/}/n");
   printf("a[1] = %d/n", a[1]);
   printf("1[a] = %d/n", 1[a]);
}

The output is :
After the declaration and defination int a[] = {1, 2, 3, 4, 5}
a[1] = 2
1[a] = 2

最后

以上就是搞怪菠萝最近收集整理的关于C语言数组特性-取下标运算中的交换律----i[a] == a[i]的全部内容,更多相关C语言数组特性-取下标运算中的交换律----i[a]内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(161)

评论列表共有 0 条评论

立即
投稿
返回
顶部