Quote (Richter @ Aug 20 2013 04:34pm)
a is not mutated after the use of copy, when i use gcc 4.6.3
i assume you and your prof have another compiler and less luck

so i can only guess why a gets mutated in your case:
due to the lack of the 0x00, the copying later (after the copying of the normal 3 bytes) goes on and the variable i still counts up. i guess your 'a' gets overwridden. (buffer overflow)
-> use a decompiler or a debugger for a more precise analysis ^^
Well, when I use gcc the following happens (check the comments):
Code
void copy(char to[], char from[]) {
/* copy from from[] to to[], assumes sufficient space */
int i = 0;
while ((to[i] = from[i]) != '\0') {
i++;
}
// printf("from[0]: %d\n", from[0]); // 0 -> NUL
// printf("from[1]: %d\n", from[1]); // 97 -> h
// printf("from[2]: %d\n", from[2]); // 10 -> LF
// printf("from[3]: %d\n", from[3]); // 0 -> NUL
}
int main() {
char a[3] = {'h', 'a', '\n'};
char b[3];
printf("a: %s", a); // prints ha
copy(b, a);
printf("a: %s", a); // prints nothing
printf("b: %s", b); // prints ha
return 0;
}