c++ - bool 函数之前预期的不合格 id?

标签 c++ compiler-errors

我正在编写一个简单(非常简单)的链表来复习我的编程技能,但显然,我失败了,因为我遇到了这个编译器错误,而且我无法弄清楚出了什么问题。问题出在删除函数上:

bool delete(node* head, node* delMe){
    node* current;

    if(delMe == head){
            if(head->next != NULL){
                    head = delMe->next;
                    free(delMe);
            }else{
                    head = NULL;
                    cout<<"There are no more elements in the LL"<<endl;
            }
            return true;
    }else{
            current = head;
            while(current){
                    if(current->next == delMe){
                            current->next = delMe->next;
                            free(delMe);
                            return true;
                    }
                    current = current->next;
            }

    }
    return false;
    }

我在“删除”之前得到了预期的不合格 ID。

我以为它可能是它上面的插入函数,但是当我完全注释掉删除函数时,程序编译没有问题。

最佳答案

delete 是 C++ 中的关键字。您不能将其用作标识符。

关于c++ - bool 函数之前预期的不合格 id?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15181958/

相关文章:

java - 使用 bouncycaSTLe 计算 SHA3 哈希值 - `error: cannot find symbol`

c++ - 仅在添加第二个项目后才出现第一个项目的编译错误

c++ - session 0 捕获屏幕

c++ - 数组大小 'exceeded' ,但数组很小

java - 错误: Could not find or load main class MyApp (running java on Command Prompt)

c++ - CUDA 常量内存错误

scala编译错误: type mismatch; found: IndexedSeq[Int] required: scala. collection.immutable.Seq[Int]

c++ - 使用 C++ 动态地从蓝色递增到红色

c++ - 迪尔德 : Symbol not found: _PyBaseObject_Type

c++ - MFC 功能区主页按钮双击关闭应用程序