Electronic Circuits - Electronic Tutorials - Electronic Hobby Projects - A Complete Electronic Resource Centre

C Language Programming Library Reference Guide

Products

Sitemap

Online
Calculators

Circuits (A-C)

Circuits (D-O)

Circuits (P-Z)

Tutorials


 
Google
 
Web Hobbyprojects.com

ctype.h - to.... Functions

Declarations:
int tolower(int character);
int toupper(int
character);
 
The to... functions provide a means to convert a single character. If the character matches the appropriate condition, then it is converted. Otherwise the character is returned unchanged.

Conditions:

tolower If the character is an uppercase character (A to Z), then it is converted to lowercase (a to z)
toupper If the character is a lowercase character (a to z), then it is converted to uppercase (A to Z)
 

Example:

#include<ctype.h>
#include<stdio.h>
#include<string.h>

int main(void)
{
  int loop;
  char string[]="THIS IS A TEST";

  for(loop=0;loop<strlen(string);loop++)
    string[loop]=tolower(string[loop]);

  printf("%s\n",string);
  return 0;
}
Search
Custom Search

<<<  Back to C Language Library Reference Guide

<<<  Back to Electronics Tutorials