It’s in the standard library, and that’s the most straight forward way I can see to implement such a function. So yes, just loop through the string and convert each character to lowercase.
Something trivial like this:
#include <ctype.h> for(int i = 0; str[i]; i++){ str[i] = tolower(str[i]); }
or if you prefer one liners, then you can use this one by J.F. Sebastian:
for ( ; *p; ++p) *p = tolower(*p);
Related Posts:
- How does strtok() split the string into tokens in C?
- How to convert an int to string in C?
- What is a string of hexadecimal digits?
- How to convert an int to string in C?
- How to convert a string to integer in C?
- How do I create an array of strings in C?
- What is the difference between char s[] and char *s?
- How do I properly compare strings in C?
- How to convert an int to string in C?
- Returning string from C function
- How do I create an array of strings in C?
- Return char[]/string from a function [duplicate]
- How to check if a string is a number?
- Return char[]/string from a function
- How to clear all the elements of array in C?
- How do I concatenate const/literal strings in C?
- Reversing a string in C
- How to remove the character at a given index from a string in C?
- Split string with delimiters in C
- Allocating string with malloc
- Removing trailing newline character from fgets() input
- Does C have a string type?
- How to concatenate string and int in C?
- The difference between char * and char[] [duplicate]
- The difference between n++ and ++n at the end of a while loop? (ANSI C)
- Implementing Taylor Series for sine and cosine in C
- Working on code to calculate cosine with factorial sum
- warning: implicit declaration of function
- pthread_join() and pthread_exit()
- Why should we typedef a struct so often in C?
- Undefined reference to pthread_create in Linux
- dereferencing pointer to incomplete type
- Get a substring of a char* [duplicate]
- What is the behavior of integer division?
- Expression must be a modifiable L-value
- Awesomium sdk download
- Bad File Descriptor with Linux Socket write() Bad File Descriptor C
- How do I use valgrind to find memory leaks?
- “error: assignment to expression with array type error” when I assign a struct field (C)
- munmap_chunk(): invalid pointer
- What is the LD_PRELOAD trick?
- What is the argument for printf that formats a long?
- Using %s in C correctly – very basic level
- How do you make an array of structs in C?
- need help understanding the movzbl call in this function
- What is the difference between read and pread in unix?
- What does “control reaches end of non-void function” mean?
- How to create my own header file in c++?
- connect Error: “No route to host”
- warning: implicit declaration of function
- Char Comparison in C
- C – The %x format specifier
- what is the unsigned datatype?
- lvalue required as left operand of assignment
- how to convert negative hexadecimal to decimal
- Why am I getting “undefined reference to sqrt” error even though I inclu de math.h header?
- Reading a string with scanf
- How to initialize a struct in accordance with C programming language standards
- Expression preceding parentheses?
- Linux equivalent of I_PUSH
- Understanding INADDR_ANY for socket programming
- getopt_long() — proper way to use it?
- C read file line by line
- The Definitive C Book Guide and List[
- When is it a good idea to use strdup (vs malloc / strcpy)
- expression must have integral type
- Why is %c used in C?
- How can I use an array of function pointers?
- What is Innermost loop in imperfectly nested loops?
- What’s wrong with my code? What is argv[1]?
- What can cause a “Resource temporarily unavailable” on sock send() command
- When and why to use malloc?
- How to solve error: expected identifier or ‘(‘
- C compile error: Id returned 1 exit status
- Efficient way to find task_struct by pid
- Why am I getting this memory access error ‘double free or corruption’?
- size of struct in C
- How to pause in C?
- (.text+0x20): undefined reference to `main’ and undefined reference to function
- Why am I getting this error: “data definition has no type or storage class”?
- I’m getting “Invalid Initializer”, what am I doing wrong?
- Error: initializer element is not computable at load time
- “No such file or directory” error in CodeBlocks
- warning: passing argument ’from incompatible pointer type [enabled by default]’
- Return a `struct` from a function in C
- Uninitialized value was created by a heap allocation
- Scanning Multiple inputs from one line using scanf
- Which of sprintf/snprintf is more secure?
- Passing string to a function in C – with or without pointers?
- Trim a string in C [duplicate]
- PTHREAD_MUTEX_INITIALIZER vs pthread_mutex_init ( &mutex, param)
- execvp: bad address error
- How detect malloc failure?
- A Simple, 2d cross-platform graphics library for c or c++?
- What primitive data type is time_t? [duplicate]
- How to format strings using printf() to get equal length in the output
- Usage of \b and \r in C
- Difference between “while” loop and “do while” loop
- Parsing command-line arguments in C
- lvalue required as increment operand