コード:
#include <stdio.h>
int main()
{
char str1[]="bombay";
char str2[]="pune";
char *s1 = str1;
char *s2 = str2;
while(*s1++ = *s2++);
printf("%s\n",str1);
}
出力:(GCC コンパイラ)
pune
しかし、私によると、出力はpuneay. puneの代わりにコピーしbomb、残りはそのままにする必要があります。
では、コンパイラがこのコードの出力を「puneay」ではなく「 pune」にするのはなぜですか?