這裏寫自定義目錄標題
'.‘和’->'使用過程中的注意事項
List_t* pxList;
ListItem_t * pxIterator;
pxIterator->pxNext->pxPrevious = pxNewListItem; //沒錯
pxIterator = pxList->xListEnd->pxPrevious; //報錯,error ,expression must have pointer type
改成pxIterator = pxList->xListEnd.pxPrevious; //錯誤解決
說明:結構體成員用’.’ 結構體指針成員用’->’,List_t結構體中的MiniListItem_t xListEnd;是結構體不是結構體指針
//結構體定義如下
struct xLIST_ITEM
{
TickType_t xItemValue;
struct xLIST_ITEM* pxNext;
struct xLIST_ITEM* pxPrevious;
void* pvOwner;
void* pvContainer;
};/*鏈表節點數據結構定義*/
typedef struct xLIST_ITEM ListItem_t;
struct xMINI_LIST_ITEM
{
TickType_t xItemValue;
struct xLIST_ITEM* pxNext;
struct xLIST_ITEM* pxPrevious;
};/*鏈表精簡節點數據結構定義*/
typedef struct xMINI_LIST_ITEM MiniListItem_t;
typedef struct xLIST
{
UBaseType_t uxNumberOfItems;
ListItem_t* pxIndex;
MiniListItem_t xListEnd;
}List_t;/*鏈表根節點數據結構定義*/
編程過程中出現的語法錯誤,以此記錄