コードの作成はほぼ完了しましたが、「curtemp: undeclared identifier
」というエラーが表示されます。および ' prevtemp: undeclared identifier
' および ' missing ';' before type
' (最後のエラーは "float curtemp = current->temp;" の行にあります。コードの何が問題なのかわかりません。双方向リンク リストからいくつかの要素を削除しようとしていますが、その要素内の温度は、前の要素の温度よりも 5 高いか 5 低いです。
ここに私の.cファイルがあります:
void remove_error(Dlist *list){
DlistElmt *current;
current = list->head;
//initializes ints for comparison
float curtemp = current->temp;
float prevtemp = current->temp;
//now moves current to next data
current = current -> next;
//begins while loop for comparison of data
while(current != NULL){
curtemp = current -> temp;
if((curtemp >= (prevtemp +5)) || (curtemp <= (prevtemp-5))){
//removes current from the list
dlist_remove(list, current);
current = current->next;
}
}
}
ここに私の構造体要素ファイルがあります:
typedef struct DlistElmt_ {
int hour;
int min;
float temp;
struct DlistElmt_ *prev;
struct DlistElmt_ *next;
} DlistElmt;