C++のプログラムを書いたところ、このエラーが出て原因がわかりません。誰でも私を助けることができますか?この関数は、リンクされたリストから i 番目の要素を削除するために使用されますが、最善を尽くしましたが、理由が見つかりません。
#include <cstdio>
#include <fstream>
using namespace std;
struct node
{
int value;
node * next;
};
typedef struct node list;
list* head = NULL;
int list_length = 0;
bool empty(){
return (head == NULL);
}
void delete(int i){
if(i>list_length) return;
if(empty()) return;
int count = 0;
list* curr = head;
while(curr != NULL && count < i-1){
curr = curr -> next;
count++;
}
list* temp = curr -> next;
curr next = temp -> next;
list_length--;
}
int main(){
}