C Online Compiler
Example: tolower() String Lowercase Conversion in C
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// tolower() String Lowercase Conversion #include <stdio.h> #include <string.h> // For strlen (optional, can use null terminator check) #include <ctype.h> // For tolower() int main() { char str[] = "AnOtHeR ExAmPlE!"; // Step 1: Initialize the string int i = 0; printf("Original string: %s\n", str); // Step 2: Iterate through the string while (str[i] != '\0') { // Step 3: Use tolower() to convert the character and assign it back str[i] = tolower(str[i]); i++; // Move to the next character } printf("Lowercase string: %s\n", str); // Step 4: Print the modified string return 0; }
Output
Clear
ADVERTISEMENTS