gpt4 book ai didi

c - 使用指针从循环数组中弹出

转载 作者:行者123 更新时间:2023-11-30 16:12:03 24 4
gpt4 key购买 nike

我想通过使用出队例程从任意点使循环数组出队。我想通过指针来做到这一点,可以吗?

unsigned char *ptrDisc, len;
unsigned char Queue[50]; //my circular array
unsigned char Pckt[20]; //array where I put my extracted data
unsigned char ind_pop, ind_push; //index from circular array

len=10; //10byte to extract
ptrDisc = (Queue+10); //first position from I want to extract data

Dequeue(ptrDisc, len, Pckt, ind_pop, ind_push);

我希望 Pckt 充满我的“len”数据,但我无法获取数据。如果我使用“QUeue”作为第一个参数,y Pckt 数组是否充满了我的数据。也许答案是“不可能,因为它是一个圆形数组”?

最佳答案

我不太明白这个问题,你的意思是循环链表中的循环数组吗?数组在运行时不晚于 block 作用域内局部变量的初始化时在固定存储量上对齐,并存储在无法更改大小的数据段中。

关于c - 使用指针从循环数组中弹出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58441425/

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