Machine-translated by Google. Questions are authored in English.
Top

Discussion

The function strlen() includes the terminating null character in the length it returns.

  • A.True
  • B.False

Answer: B

Correct answer: False

strlen() counts only the characters before the terminating null, so strlen("abc") is 3. The array holding that string nevertheless needs 4 bytes, which is why sizeof and strlen give different answers.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.