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.
Loading...
Related Quiz
- The use of inline functions can potentially lead to faster execution time but may also increase the ________ of the binary.
- The function ________ can be used to determine the size of a file in C.
- You are working on a program that processes user input, and you want to ensure that the input string does not exceed a certain length to prevent buffer overflow. Which string handling function would be appropriate to use?
- The ________ loop checks the condition before executing the block of code.
- In a union, all members share the same ________.