#include <stdio.h>
int main(void)
{
char b[5];
scanf("%4s%4s", b, b);
//My input: "qwer<Enter>sgsh<Enter>"
printf("%s", b);
//Output: sgsh
}
Run Code Online (Sandbox Code Playgroud)
C99:在上一个和下一个序列点之间,对象最多应通过表达式的评估修改其存储的值一次。
在这种情况下,我正在修改b twice. 不是undefined behavior吗?