Is ++ the same as += 1 for pointers?
问题 I'd like to refactor some old C code of mine, and I was curious if I can replace all ptr++ with ptr += 1 where ptr is some pointer, without changing any behavior. Here's an example of what I mean, from K&R Section 5.3: /* strlen: return length of string s*/ int strlen(char *s) { int n; for (n = 0; *s != '\0'; s++) n++; return n; } When I replace the s++ with s += 1 , I get the same results, but I'm wondering if this will be the case for all types. I also did a test for int s: int size = 10;