以下程式將英文字串全部改為小寫字母
#include <stdio.h>
#include <ctype.h>
int main(void)
{
char *t = "SEEING IS BELIEVING";
char s[20];
int i = 0;
while (*t != '\0') {
s[i] = tolower(*t);
t++;
i++;
}
printf("%s\n", s);
return 0;
}
/* 《程式語言教學誌》的範例程式
http://pydoing.blogspot.com/
檔名:ctolower.c
功能:示範 ctype.h 中函數 tolower() 的使用
作者:張凱慶
時間:西元2010年6月 */編譯後執行,結果如下

您可以繼續參考
沒有留言:
張貼留言