#include <ctype.h>
|
|
int
tolower (int c); |
The functionality of this API is independent of the program’s current locale.
#include<ctype.h> //tolower()
#include<stdio.h> //printf()
int test_tolower ()
{
struct st
{
int input;
int output;
};
struct st arr[]=
{
{ ’Q’, ’q’ },
{ ’g’ , ’g’ },
{ ’9’ , ’9’ },
{ ’%’ , ’%’ },
{ ’\t’ , ’\t’ },
};
int i = 0;
int size = 5;
for( i=0; i<size; i++)
{
int ret = tolower(arr[i].input);//call to the API with the chars in the arr[]
if( ret != arr[i].output )
{
printf("\n%c cannot convert ", arr[i].input);
}
else
{
printf("\n%c ", arr[i].output);
}
}
printf("\n");
}
Output
q
g
9
%
|
© 2005-2007 Nokia |