'.'和'->'使用过程中的注意事项

这里写自定义目录标题

'.‘和’->'使用过程中的注意事项

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;/*链表根节点数据结构定义*/

编程过程中出现的语法错误,以此记录
发布了9 篇原创文章 · 获赞 12 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/lmx11040101/article/details/102983641