[問題] 結構和指標定義問題
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
C語言
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
最近剛學資料結構,關於書本中Linklist的寫法不太懂他的意思
程式碼(Code):(請善用置底文網頁, 記得排版)
struct listNode{
char data;
struct listNode *nextptr;
};
typedef struct listNode ListNode;
typedef ListNode *ListNodeptr;
void insert(ListNodeptr *sptr,char value)
void delete(ListNodeptr *sptr,char value)
int empty (ListNodeptr sptr)
補充說明(Supplement):
1.想請問為什麼ListNodeptr被定義成指向ListNode的指標
但在函式中卻可以同時使用ListNodeptr *sptr和ListNodeptr sptr的形式
2.關於前面結構定義的部分為什麼不可以寫成下列形式:
typedef struct{
char data;
struct ListNode *nextptr;
}ListNode;
typedef ListNode *ListNodeptr;
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.19.236
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1429109962.A.C25.html
→
04/16 11:29, , 1F
04/16 11:29, 1F
→
04/16 13:35, , 2F
04/16 13:35, 2F
→
04/16 13:36, , 3F
04/16 13:36, 3F
→
04/16 13:36, , 4F
04/16 13:36, 4F
→
04/16 13:37, , 5F
04/16 13:37, 5F
討論串 (同標題文章)