C - pointer behavior with pre and post increment

前端 未结 6 1320
日久生厌
日久生厌 2021-01-22 08:50

In am doing some experiment in C pointers and trying to understand its behaviour. The following are my assumptions for the below codes. Correct me if I am wrong. I have the foll

6条回答
  •  清酒与你
    2021-01-22 09:24

    It is due to operator precedence in C. The below link may help you

    Increment or decrement operator has higher precedence that dereference operator.So your

    *ptr++; is similar to *(ptr++)
    

    http://www.difranco.net/compsci/C_Operator_Precedence_Table.htm

提交回复
热议问题