C language to implement the letter case conversion method
- 2020-04-02 03:07:57
- OfStack
This article illustrates a case - case conversion method in C language. Share with you for your reference. The specific implementation method is as follows:
#include <stdio.h>
int lower(int c)
{
return ((c>='A')&&(c<='z'))?(c+'a'-'A'):(c);
}
main()
{
int i;
char a[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(i=0;i<26;i++){
printf("%c result is %d ------ %cn",a[i],lower(a[i]),(char)lower(a[i]));
}
}
Hope that the article described in the C programming language for you to help.