Stack.cpp: In copy constructor ‘Stack::Stack(const Stack&)’:
Stack.cpp:48: error: cannot convert ‘int*’ to ‘char*’ for argument ‘1’ to ‘char* strcpy(char*, const char*)’
Stack.cpp: In member function ‘Stack& Stack::operator=(const Stack&)’:
Stack.cpp:67: error: cannot convert ‘int*’ to ‘char*’ for argument ‘1’ to ‘char* strcpy(char*, const char*)’
Stack.cpp: In member function ‘void Stack::push(int)’:
Stack.cpp:167: error: cannot convert ‘int*’ to ‘char*’ for argument ‘1’ to ‘char* strcpy(char*, const char*)’
Stack.cpp:169: error: cannot convert ‘int**’ to ‘int*’ in assignment
Stack.cpp: In member function ‘void Stack::pop() const’:
Stack.cpp:189: error: decrement of data-member ‘Stack::stacksize’ in read-only structure
Stack::Stack(const Stack& s)
{
stacksize = s.stacksize;
stackcapacity = s.stackcapacity;
stackarray = new int [stackcapacity];
strcpy(stackarray, s.stackarray);
}
strcpy() doesn't work with any array - only char arrays (C-style strings) - due to the nature of how it works. Like you say, you'll need to iterate over the arrays and swap each element individually. How much do you know about using for loops?