what does the - operator do with char *?

后端 未结 4 2006
忘了有多久
忘了有多久 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:46

    Read more on pointer arithmetic.

    Basically + for char *:

    a=a+1  =>  a=(char *) ( (int)a + sizeof(char) )
    

提交回复
热议问题