In a database application, you need to sort a list of names (strings) in alphabetical order. Which string handling function might be useful in this scenario?
- strchr
- strcmp
- strnlen
- strtok
To sort a list of names in alphabetical order, the strcmp function is useful. It compares two strings and returns a value indicating their relative order. strtok is used for tokenizing strings, strchr searches for a character in a string, and strnlen provides the length of a string up to a specified limit.
Loading...
Related Quiz
- What is the default value of elements in an array declared as int arr[5]; in C?
- What is the scope of a global variable in a C program?
- You are tasked with optimizing a C program that manipulates large strings. What standard library functions might be critical to review for potential performance bottlenecks?
- In a graphics rendering engine, you need to apply different transformations (e.g., rotate, scale, translate) to objects. How can function pointers be used to simplify the implementation?
- When reading a file, if the end of the file is reached, the ________ function can be used to check this condition.