typedef type alias
(好吧好像也都是這樣)
所以平常可能就會這樣啊
typedef double dbl
所以 dbl x = 2.0 就等於 double x = 2.0
但是typedef struct 都一直搞混
typedef struct 長這樣:
********************
typedef struct node{
type value;
struct node* next;
}Node;
********************
struct 長這樣:
********************
struct node{
type value;
struct node* next;
}Node;
********************
然後就要解釋一下每次都困惑我的東西了~~
搭拉~~~~

所以這樣看typedef就不會怪怪的啦
寫成一行就會變成這樣
typedef struct node{type value;struct node* next;} Node;
紅色是type,藍色是alias
解釋紅色那坨:
型態是 struct node,大括號裡面是struct 的內容
因為只把type換掉,所以後面接的東西跟原本非typedef的東西不一樣
就像這樣
所以兩個是完全不同的呦!!!
雖然長得很像XD
有誤請告知:b,感恩感恩
沒有留言:
張貼留言