-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