What does the strlen function from the C standard library do?

  • Allocates memory for a new string
  • Calculates the length of a string
  • Compares two strings
  • Copies one string to another
The strlen function in C calculates the length of a string by counting the number of characters until it reaches a null-terminator. It does not allocate memory or perform string copying.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *