What is the difference between iPP and iTunes 1 when using the comparison operator in CPP?

this is the insert function of the array linear table written in CPP. In the second if condition, there is no problem if you use listSize+1, but there is an error (non-compilation error) if you execute the listSizePP program

.
void insert(int location, elementtype theElement)
    {
        if(location > arrayLength - 1)
            cout<<"List is full."<<endl;
        if(location > (listSize+1) || location < 1 )
            cout<<"Please enter correct value."<<endl;
        else
        {
            for(int n = listSize; n >= location; n--)
                elements[nPP] = elements[n];
            elements[location] = theElement;
            listSizePP;
        }
    }
Is there any difference between

iPP and iTune1 in the comparison operator?

Mar.12,2021

The statement:

    if(location > listSizePP || location < 1 )
        cout<<"Please enter correct value."<<endl;

can be considered like

    if(location > listSize || location < 1 )
    {
        PPlistSize;
        cout<<"Please enter correct value."<<endl;
    }
    

From the CPP Standard (5.2.6 Increment and decrement)

1 The value of a postfix PP expression is the value of its operand. [Note: the value obtained is a copy of the original value-end note].

So, it will change listSize's value (because of PPlistSize; ), which is not you hope to see.

Menu