I'm a new in learning C and I do not completely understand how 'void' function can modify some variables. For example
void copyString (char to[], char from[])
{
int i;
for ( i = 0; from[i] != '\0'; ++i )
to[i] = from[i];
to[i] = '\0';
}
Why can I use modified version of 'to' string? Shouldn't it be modified only in a copyString's stack and not for the whole programm or I misunderstand something? I understand that 'to' is a formal parameter, but I thought that it shoul change the value only inside the function because it is local to that function. Please explain where the problem in my logic?