tolower() - C函數

C庫函數 int tolower(int c)轉換給定的字母為小寫。

聲明

以下是聲明的tolower()函數。

int tolower(int c);

參數

  • c -- 這是字母轉換為小寫。

返回值

這個函數返回小寫相當於c,如果存在的值,否則c保持不變。返回值可以隱式char為int值。

例子

下麵的例子顯示的tolower()函數的用法。

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

int main()
{
   int i = 0;
   char c;
   char str[] = "zaixianS POINT";

   while( str[i] )
   {
      putchar(tolower(str[i]));
      i++;
   }

   return(0);
}

讓我們編譯和運行上面的程式,這將產生以下結果:

zaixians zaixian

上一篇: isxdigit() - C函數 下一篇: toupper() - C函數