switch函数为什么不运行??

char compare(int a, int b)
{
    if (a > b)
        return '>';
    else if (a < b)
        return '<';
    else
        return '=';
}

 while ((p != NULL) && (q != NULL))
    {
        cout << "加法运算结果如下:" << endl;
        switch (compare(p->exp, q->exp))
        {
        case '=':
        {
            cout << "11" << endl;
            x = p->coef + q->coef;
            if (x)
                d = attch(x, p->exp, d);
            p = p->next; q = q->next;
        }
        break;
        case '>':
        {
            cout << "22" << endl;
            d = attch(p->coef, p->exp, d);
            p = p->next;
        }
        break;
        case ' < ':
        {
            cout << "33" << endl;
            d = attch(q->coef, q->exp, d);
            q = q->next;
        }
        break;
        default:
            break;
        }
    }

在while函数中始终不执行switch函数  该while是一个死循环

到底是什么问题  怎么修改????

 

p 和 q 都是非空么?

C和C++完整教程:https://blog.csdn.net/it_xiangqiang/category_10581430.html
C和C++算法完整教程:https://blog.csdn.net/it_xiangqiang/category_10768339.html