tolower function converts an uppercase character to lowercase character if such value exists for input character. If no such conversion is possible, it returns same character unchanged.
Function prototype of tolower
int tolower(int c);
Function tolower takes a character as input in form of an integer. When we pass a value of type char to tolower() function, corresponding ASCII value of that character is passed.
Return value of tolower
Tolower.c: Function tolower returns lowercase equivalent to c, if such value exists, or c (unchanged) otherwise.
C program using tolower function
Tolower c: The following program does uppercase to lowercase alphabet conversion using tolower() function.
#include <stdio.h> #include <ctype.h> #include <conio.h> int main(){ char string[] = "TechCrashCourse.com"; int index = 0; while(string[index] != '\0'){ printf("%c", tolower(string[index])); index++; } getch(); return 0; }
Output
techcrashcourse.com