I wrote the following c program:
int main()
{
char a[1];
char b[6]="hello\0";
int c, i;
for(i = 0; (c = getchar()) != EOF; i++)
a[i] = c;
for(i = 0; i < 5; i++)
printf("%c", b[i]);
}
Why when I give "bye" in input the program print "helby"? I thought 'b' should be saved in a[0], 'y' in b[0] and 'e' in b[1]. Thank you in advice!