Search code examples
c++compiler-errorsidentifier

C++ unexpected 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;
}

I am getting an unidentified identifier error at the int before print_cats. It's been a little while since I used c++, but I think I remember that being a lack of ";" error, but for the life of me I haven't found it.


Solution

  • Not sure, but should it be "int extras::print_cats()" instead.