logo

Crowdly

Consider the following five functions: char* f1(char* s) { s += 5; *s = 0;...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Consider the following five functions:

char* f1(char* s)

{

s += 5;

*s = 0;

return s;

}

char* f2(char* s1)

{

char* s2 = s1;

s2[5] = '\0';

return s1;

}

char* f3(char* s1)

{

char s2[5] = s1;

return s2;

}

char* f4(char* s)

{

return strstr(s, "Hello");

}

char* f5(char* s1)

{

char* s2 = NULL;

strncpy(s2, s1, 5);

return s2;

}

and consider the following variable:

char string[] = "Hello world!";

For each of the functions, choose the appropriate statement when called on string.

More questions like this

Want instant access to all verified answers on moodle.epfl.ch?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!