Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following two loops represent the behavior of two functions in the standard

ID: 3548583 • Letter: T

Question

The following two loops represent the behavior of two functions in the standard C library.Can you identify what these loops do, and which function they stand for?

 int __________( char *s )
{
char *s1 = s;
while (*s1 != 0)
s1++;
return s1 - s;
}
 char *__________( char *s1, char *s2 )
{
char *s = s1;
while ( (*s1 = *s2) != 0 )
{ s1++; s2++; }
return s;
}
The following two loops represent the behavior of two functions in the standard C library.Can you identify what these loops do, and which function they stand for?

 int __________( char *s )
{
char *s1 = s;
while (*s1 != 0)
s1++;
return s1 - s;
}
 char *__________( char *s1, char *s2 )
{
char *s = s1;
while ( (*s1 = *s2) != 0 )
{ s1++; s2++; }
return s;
}
  int __________( char *s )
{
char *s1 = s;
while (*s1 != 0)
s1++;
return s1 - s;
}
  char *__________( char *s1, char *s2 )
{
char *s = s1;
while ( (*s1 = *s2) != 0 )
{ s1++; s2++; }
return s;
}

Explanation / Answer

1)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote