Invalid comparison between pointer and integer

Hello, I keep getting errors saying "Invalid conversion from pointer to integer" and I have tried both of the following operators * after the variable as well as & and nothing seems to work. All input is greatly appreciated. Thank you all for your time.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

void Stack::print( )
{

    StackPtr temp;

    tosPtr = temp;

    while(temp != NULL)
    {
        cout << elements  -> temp;
    }
    if (isEmpty( ))
    {
        cout << "Stack is empty" << endl;
    }
    else
    {
        for (int k = tosPtr; k >= 0; k--)
        {
            cout << setw(5) << elements[k];
            if (k == temp*)
                cout << " <- top of stack";
            cout << endl;
        }
        cout << "-----" << endl;
    }
}



Last edited on
1
2
3
4
    while(temp != NULL)
    {
        cout << elements->temp;
    }
¿what?


Also, dyslexia.
Topic archived. No new replies allowed.