Asked by Tanya Ottosson on Jun 10, 2024

verifed

Verified

Line ____ in the following section of code checks for the end-of-string character.
1 void strcopy (char string1[], char string2[])
2 {
3 int i = 0;
4
5 while (string2[i] != '\0')
6 {
7 string1[i] = string2[i];
8 i++;
9 }
10 string1[i] = '\0';
11 }

A) 3
B) 5
C) 7
D) 10

End-Of-String Character

A special character used in programming to mark the termination of a string, typically the null character '\0'.

Strcopy

A function in C for copying one string into another, ensuring the destination string has enough space to accept the source string.

  • Understand the significance of correct termination in operations involving string copying and manipulation.
verifed

Verified Answer

ST
sajitha thomasJun 11, 2024
Final Answer :
B
Explanation :
Line 5 checks for the end-of-string character ('\0') to determine when to stop copying characters from string2 to string1.