指针访问数组元素-创新互联

成都创新互联公司秉承实现全网价值营销的理念,以专业定制企业官网,网站建设、网站设计,重庆小程序开发公司,网页设计制作,成都做手机网站成都全网营销推广帮助传统企业实现“互联网+”转型升级专业定制企业官网,公司注重人才、技术和管理,汇聚了一批优秀的互联网技术人才,对客户都以感恩的心态奉献自己的专业和所长。>#include <stdio.h> 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)); } }

网站标题:指针访问数组元素-创新互联
分享地址:https://www.cdcxhl.com/article18/dpohdp.html

成都网站建设公司_创新互联,为您提供动态网站网站维护建站公司外贸网站建设网站设计网页设计公司

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都网站建设