-2
我想获取指向c中链接列表中元素的指针。 这是我的代码。我得到的错误“不兼容的类型时,返回类型'bigList',但'结构bigList **'的预期”。请帮忙。感谢找到指向链接列表中的元素的指针c
/*this is the struct*/
struct bigList
{
char data;
int count;
struct bigList *next;
};
int main(void)
{
struct bigList *pointer = NULL;
*getPointer(&pointer, 'A'); //here how do I store the result to a pointer
}
/*function to return the pointer*/
bigList *getPointer(bigList *head, char value)
{
bigList temp;
temp=*head;
while(temp!=NULL)
{
if(temp->data==value)
break;
temp = temp->next;
}
return *temp; //here I get the error I mentioned
}
至少语法,请...!如果你甚至懒得仔细阅读C教程中关于指针语法的部分,那么你对于发生什么事情一定没有丝毫的想法,这很危险。 – 2013-02-28 21:39:59
对不起。即时通讯新的C,我忘了添加我使用的typedef声明。我觉得我搞砸了...有很多东西要研究..指针混淆.. – user1476263 2013-02-28 21:58:43