increment value of int being pointed to by pointer

后端 未结 2 952
南旧
南旧 2020-12-14 05:32

I have an int pointer (i.e., int *count) that I want to increment the integer being pointed at by using the ++ operator. I thought I w

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-14 06:00

    Try using (*count)++. *count++ might be incrementing the pointer to next position and then using indirection (which is unintentional).

提交回复
热议问题