Electronics Circuits & Tutorials
Electronics Circuits & Tutorials

Tutorials

     more....

Dictionaries

     more....

Projects
Home > Electronics Tutorials > C Language Tutorial > ctype.h - to.... Functions

C Language Programming Library Reference Guide

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;
}
Note: To report broken links or to submit your projects, tutorials please email to Webmaster

Circuits
A B C D
E F G H
I J K L
M N O P
Q R S T
U V W X
Y Z
Discover

     more......

Copyright © 1999-2011 www.hobbyprojects.com  (All rights reserved)