Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

C Library Function - tolower()

C Library Function - tolower()

C Standard Library - <ctype.h> C Standard Library -

Description

C Library Function int tolower(int c) Converts the given letter to lowercase.

Declaration

Below is the declaration of the tolower() function.



int tolower(int c);

Parameters

Return Value

If c has a corresponding lowercase letter, the function returns the lowercase letter of c; otherwise c remains unchanged. The return value is an int value that can be implicitly converted to type char.

Example

The following example demonstrates the use of the tolower() function.

Example

#include

<

stdio.h

#include

<

ctype.h

int

main

(

)

{

int

i

=

0

;

char

c

;

char

str

[

]

=

"

RUNOOB

"

;

while

(

str

[

i

]

)

{

putchar

(

tolower

(

str

[

i

]

)

)

;

i

++;

}

return

(

0

)

;

}

Let's compile and run the above program, which will produce the following result:



runoob

C Standard Library - <ctype.h> C Standard Library -