ucsbme, no. You could do it this way but it would still be wrong. Listen to what the Dog said. Here is what the function should look like
Code:
void f(char *s, int max_size) {
strncpy(s, "whooo", max_size);
}
The reason you want to have the second parameter is because you have no other way of knowing the size of the buffer that is pointed to by "s." Also remember
Code:
void f(char *s) {
s = "whooo";
}
//and
void f(char **s) {
*s = "whooo";
}
both point s to a temporary array. In other words "s" is only valid until the function terminates. Use strcpy or something like this function.