我繼續之前,這裏是它給了我一個錯誤代碼:C,「衝突的類型......」錯誤
#define numScores 3 // the number of test scores which a student will have
struct btreenode{
int studentID; // the ID number of the student at the current node
float scores[3]; // the 3 test scores of the student
float average; // the average of the 3 test scores for the student
struct btreenode *left; // pointer to left side of the tree
struct btreenode *right; // pointer to right side of the tree
};
typedef struct btreenode *Node;
我收到以下錯誤,當我編譯:
btreenode.h:17: error: redefinition of 'struct btreenode'
btreenode.h:28: error: conflicting types for 'Node'
btreenode.h:28: note: previous declaration of 'Node' was here
我在頂部,這樣,行號是關的塊評論,但是
線17是第一行的「struct btreenode{
」
第28行是最後一行「typedef struct btreenode *Node
」
有誰知道我爲什麼會收到這些錯誤?
你的意思是'struct btreenode * Node;'? – herohuyongtao
對我來說沒有錯誤。 [查看成功編譯的在線演示](http://codepad.org/r2pHTtuE)。 –
也爲我編譯成功。 –