how to implement strlwr in C source code

This snippet submitted by Syed Rafey Husain on 2005-11-22. It has been viewed 5320 times.
Rating of 5.9 with 14 votes

char * strlwr(char * s)
{
        char *t = s;

        if (!s)
        {
                return 0;
        }

        int i = 0;
        while ( *t != '\0' )
        {
                if (*t >= 'A' && *t <= 'Z' )
                {
                        *t = *t + ('a' - 'A');
                }
                t++;
        }

        return s;
}




More C and C++ source code snippets

Add a snippet!