<分区>
在将 void* 指针传递给该结构的基地址时,我无法访问该结构的成员。谁能提供解决方案或向我解释错误?现在我收到消息“goroutines.c:142:31: error: request for member ‘qtail’ in something not a structure or union”
//Channel struct
struct channel{
int magicnumber;
int length;
int capacity;
struct gcb* qhead; //head of the queue
struct gcb* qtail; //tail of the queue
};
void *makeChannel(int dataLength, int capacity){
if( dataLength <= 0){
panic( "data length must be greater than zero" );
}
if( capacity < 0){
panic( "capacity must be non-negative" );
}
struct channel* ch = (struct channel* )malloc( dataLength * capacity );
ch->magicnumber = 0x1ca91ac3;
ch->capacity = capacity;
ch->length = 0;
return ch;
}
void sendChannel(void *channel, void *fetchAddress){
if( capChannel( channel ) == lenChannel( channel ) ){
(struct channel* )&channel->qtail->next = head;
}
}