3 ms·
void strcpy(char *x, char *y) { while(*x++ = *y++); } In this example, why does the loop terminate? Is it because the null terminator counted as a false?
by OseOse 13y ago
void strcpy(char *x, char *y) { while(*x++ = *y++); }
In this example, why does the loop terminate? Is it because the null terminator counted as a false?
- deleted 13y ago[deleted]
- tel 13y agoExactly, since C strings are just pointers to raw memory you usually assume that either the user passes the length explicitly to you or that they're \0-terminated.