How to Convert String into Lowercase in C Without Using Strlwr?

We are all aware strings may be manipulated to upper- and lowercase. This article will describe how to convert a string to lowercase, both with and without using strlwr function in C.

What is Strlwr() Function in C?

Lowercase conversion is accomplished using the built-in C function strlwr(), which handles strings.

The words “str” and “lwr” stand for string and lower, respectively, as their names suggest.

Syntax: strlwr(char string);

A string is the string value that has to be changed.

Also Read: How to Change String into Uppercase without Strupr function in C?

How to Convert String into Lowercase Using Strlwr Function in C?

An example of the strlwr() function in C is shown in the program below:


Char str[] =”HELLO wORld”;

defining the string variable str with the char data type.


Lowercase conversion of the str value.

The code in the preceding paragraph will output the changed string created after lowercasing the characters in the string str provided.

Output: Hello world

Also Read: How to Compare two Strings Without Using Strcmp in C?

How to Convert String into Lowercase in C Without Using Strlwr Function in C?

Without strlwr(), an ASCII (American Standard Code for Information Interchange is the name of the acronym) value can convert a string to lowercase.

The letters and numbers 0 through 9 are included, along with a few unique symbols and the lowercase and capital letters A through Z.

Lowercase “a” to “z” ASCII codes range from 97 to 122, whereas uppercase “A” to “Z” ASCII codes range from 65 to 90.

To convert the string to lowercase without using strlwr(), use the following syntax:

int main()

//starting point for program execution.


char str[] = “HELLO wORld”;

//declare a str variable

int i = 0;

//integer type variable ‘i’ to keep track of string index.

while (s[i] != ‘\0’) {

//while loop to check the endpoint of the string.

if (s[i] >= ‘A’ && s[i] <= ‘Z’) {

//checking the ASCII range of the string.

s[i] = s[i] + 32;

//incrementing the value in case the ASCII range is between the uppercase range.


//end of the condition.


//increasing i i.e., i = i+1;


//end of while loop


//print transformed str


//end of the main function

Greetings, My name is Rumi Sadaf. I work as both a content writer and a programmer. In essence, I explain what I know and aid others in understanding programming concepts. Happy Viewing.

Leave a Comment