what does the - operator do with char *?

后端 未结 4 2000
忘了有多久
忘了有多久 2021-01-26 07:27

I new to C. I am reading a find-replace algorithm for C and I am a bit confused what the - & + operators do in this code:

char *re         


        
4条回答
  •  囚心锁ツ
    2021-01-26 07:45

    p is just a pointer - an integer value.

    The + and - operators work exactly as you'd expect - they increment or decrement the value of the pointer.

    If you think of strings as a contiguous array of chars, you're just talking about a location within that string.

提交回复
热议问题