logo

Crowdly

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

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

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.

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.epfl.ch?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!