[問題] 有關於typedef省略的問題?

作者: cat99961 (阿湯)   2020-05-11 14:37:18
1. #include <stdlib.h>
2. #include <stdio.h>
3. struct tree /* 樹的結構宣告 */
4. {
5. int data; /* 節點資料 */
6. struct tree *left; /* 指向左子樹的指標 */
7. struct tree *right; /* 指向右子樹的指標 */
8. };
9. typedef struct tree treenode; /* 樹的結構新型態 */
10.typedef struct tree *btree; /* 宣告樹節點指標型態 */
/*
作者: b0920075 (Void)   2020-05-11 14:45:00
insert node 那邊你把 btree 當 data type 了吧
作者: shadow0326 (非議)   2020-05-11 14:45:00
刪掉之後btree就是一個variable,不是一個type所以11行就gg
作者: chuegou (chuegou)   2020-05-11 21:08:00
就...unknown type name ‘btree’ 沒有btree這個型別阿

Links booklink

Contact Us: admin [ a t ] ucptt.com