Hi all,
consider the following code:
t[7] = "Hellow\0";
s[3] = "Dad";
//now copy t to s using the following strcpy function:
void strcpy(char *s, char *t) {
int i = 0;
while ((s[i] = t[i]) != '\0')
i++;
}
the above code is taken from "The C programming Language book". my question is - we are copying 7 bytes to what was declared as 3 bytes. how do I know that after copying, other data that was after s[] in the memory wasn't deleted?
and one more question please: char *s
is identical to char* s
?
Thank you !