This is what I have so far in writing my class stack, in the reverse function I keep getting an error that says " no operator "[]" matches these operands operand types are: stack [int]"
I am simply trying to make another stack to push all of the elements of the first stack onto to reverse their order, but I keep getting that error when I hover over the "[i]" in the reverse function.
Can anyone help me to correct this or let me know of a better way to reverse the order of the stack using only the push and pop functions?
I am simply trying to make another stack to push all of the elements of the first stack onto to reverse their order, but I keep getting that error when I hover over the "[i]" in the reverse function.
That's probably because s1 and s2 are not arrays, they are two single stack instances.