C/C++ post-increment/-decrement and function call [duplicate]
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Undefined Behavior and Sequence Points I am using microsoft visual c++. Look at the following example: int n = 5; char *str = new char[32]; strcpy(str, "hello world"); memcpy(&str[n], &str[n+1], 6+n--); printf(str); // output is "hell world" So unexpectadly my compiler produces code that first decrements n and then executes memcpy. The following source will do what i expected to happen: int n = 5; char *str =