Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

C, single linked list flip function

Shulou Source: shulou.com Published: 2022-06-03 07:21:11 11月23日 Update

Struct ST_StackNode {int num; datatype data; struct ST_StackNode * pNext; / / pointer domain}; typedef struct ST_StackNode StackNode;StackNode* reverse (StackNode* phead) {if (phead = = NULL) {return NULL;} if (phead- > pNext = = NULL) {return phead;} StackNode* pre, * cur, * next; cur = phead- > pNext; phead- > pNext = NULL; pre = phead While (cur! = NULL) {next = cur- > pNext; cur- > pNext = pre; pre = cur; cur = next;} phead = pre; return phead;}

Tags: Pointer function Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Xiaomi Shulou Technology Apple vpn