Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 2, 2019 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/016e7a8901e50c4d8d4e659d5ea17079 to your computer and use it in GitHub Desktop.
Save parzibyte/016e7a8901e50c4d8d4e659d5ea17079 to your computer and use it in GitHub Desktop.
/*
Convert C string to lowercase
@author parzibyte
*/
#include <stdio.h>
#include <ctype.h>
int main(int argc, char const *argv[])
{
char my_string[] = "Hello world! this is a simple string. parzibyte.me";
printf("Original string: %s\n", my_string);
// Convert each char
// using tolower
for (int index = 0; my_string[index] != '\0'; ++index){
my_string[index] = tolower(my_string[index]);
}
printf("After convert: %s\n", my_string);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment