C String Lowercase: strlwr()

The strlwr() function is a C library function that is used to convert a string to lowercase. However, it is important to note that strlwr() is not a standard C function and is not supported by all compilers. It is a non-standard function that is provided by some compilers for compatibility with older code.

Here’s an example of how strlwr() can be used:

#include <stdio.h>
#include <string.h>

int main() {
    char str[] = "Hello World";
    
    printf("Original string: %s\n", str);
    
    strlwr(str);
    
    printf("Lowercase string: %s\n", str);
    
    return 0;
}

Output:

Original string: Hello World
Lowercase string: hello world

Please note that if you’re using a compiler that does not support strlwr(), you can implement your own function to convert a string to lowercase. Here’s an example of such a function:

#include <ctype.h>

void strlwr(char* str) {
    while (*str) {
        *str = tolower((unsigned char)*str);
        str++;
    }
}

This function uses the tolower() function from the <ctype.h> library to convert each character of the string to lowercase.