How to implement strlwr in C

Submitted by:Andery Smith

Date added:13 January, 2016

Category:C

Example code to implement strlwr in C

Tags: function , strlwr

Code Snippet:

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;
}
 
 

Comments