gpt4 book ai didi

c - 双指针 C/C++

转载 作者:行者123 更新时间:2023-12-05 09:01:36 25 4
gpt4 key购买 nike

<分区>

谁能给我解释一下双指针是如何工作的?例如,在这段代码中,为什么它打印它最后打印的值?

int main(void) {
int anArray[] = {5,16,33,99};
int * p = anArray;

printf("*p = %d\n", *p);
p++;
printf("Now *p = %d\n", *p);

int * q = &anArray[3];
int ** x = &q;
**x = 12;
*x = p;
**x = 42;
q[1] = 9;

for (int i =0; i < 4; i++){
printf("anArray[%d] = %d\n",i, anArray[i]);
}

return EXIT_SUCCESS;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com