C++ 意外标识符

标签 c++ compiler-errors identifier

#include "cs163hw1.h"

extras::extras(int num_cats){
head = new category_node;
head->next = NULL;
head->category = num_cats;
category_node * temp;
for(int i = 1; i < (num_cats); ++i){
    temp = new category_node;
    temp->next = head;
    head = temp;
    head->category = (num_cats-i);
}
}

extras::~extras(){
category_node * temp;
while(head->next){
    temp = head;
    head = head->next;
    delete temp;
}
delete head;
}

extras::int print_cats(){
category_node * current;
while(current){
    cout << current->category << endl;
    current = current->next;
}
return 1;
}

我在 print_cats 之前的 int 处收到一个未识别的标识符错误。自从我使用 C++ 以来已经有一段时间了,但我想我记得缺少“;”错误,但我一直没找到它。

最佳答案

不确定,但应该改为“int extras::print_cats()”。

关于C++ 意外标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12649095/

相关文章:

c++ - mailto:确认状态

c++ - 更改Windows 7/8跳转列表上MFC应用程序的应用程序标题

linux - MPI 无法编译基准(对 `MPI_Type_extent' 的 undefined reference )

asp.net-mvc - Razor 编译器警告/错误 - ASP.NET MVC 4

xcode - 为wxWidgets应用程序创建Xcode项目时出错

ios - CSStickyHeaderFlowLayout swift 接收器没有带标识符的 segue

c++ - 为什么 RemoveDirectory 函数不删除最顶层的文件夹?

c++ - 使用 boost::pool 管理 std::vector 中的内存分配

以下划线开头的 PHP SOAP 操作

scheme - 方案中标识符和符号之间的区别?