Перед тем, как продолжить, вот код, который дает мне ошибку: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). –
скомпилирован для меня тоже. –