把一串字符串大写转成小写

来源:互联网 发布:淘宝sns是什么 编辑:程序博客网 时间:2024/06/06 09:20

tolower函数:

功 能: 把字符转换成小写字母,非字母字符不做出处理
头文件:在VC6.0可以是ctype.h或者stdlib.h,常用ctype.h
用 法: int tolower(int c);
说明:和函数int _tolower( int c );功能一样,但是_tolower在VC6.0中头文件要用ctype.h


实例:

#include <stdio.h>
#include <string.h>
#include <ctype.h>
void main()

char string[30];
int i,length;
gets(string);
length=strlen(string);
for(i=0;i<length;i++)
string[i]=tolower(string[i]);
printf("%s",string);
}

0 0
原创粉丝点击