RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
指针访问数组元素-创新互联

成都创新互联公司秉承实现全网价值营销的理念,以专业定制企业官网,网站建设、网站设计,重庆小程序开发公司,网页设计制作,成都做手机网站成都全网营销推广帮助传统企业实现“互联网+”转型升级专业定制企业官网,公司注重人才、技术和管理,汇聚了一批优秀的互联网技术人才,对客户都以感恩的心态奉献自己的专业和所长。>#include int *p = (int[]){8, 7}; // creates an unnamed static array of type int[2] // initializes the array to the values {2, 4} // creates pointer p to point at the first element of the arrayvoid main(void) { int n = 99, *p = &n; // 此时 *p == 99; printf("n: %d ", *p); p= (int [2]){*p}; // creates an unnamed automatic array of type int[2] // initializes the first element to the value formerly held in *p // initializes the second element to zero // stores the address of the first element in p // 此时 数组为 [99, 0] p指向数组中的首元素(99) // 数组指针访问数组元素,只要在 地址不断加1 即向下移动一个单元 for (int i = 0; i < 2; i++) { printf("array %d %d ", i, *(p + i)); } }
名称栏目:指针访问数组元素-创新互联
网页网址:http://sczitong.cn/article/dpohdp.html