mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 06:35:35 +08:00
32 lines
998 B
HTML
32 lines
998 B
HTML
<h1>字符函数 - isalpha</h1>
|
||
<p>原型:extern int isalpha(int c);</p>
|
||
<p>用法:#include <ctype.h></p>
|
||
<p>功能:判断字符c是否为英文字母</p>
|
||
<p>说明:当c为英文字母a-z或A-Z时,返回非零值,否则返回零</p>
|
||
|
||
举例:
|
||
<pre><code class="language-c">
|
||
// isalpha.c
|
||
|
||
#include <syslib.h>
|
||
#include <ctype.h>
|
||
#include <stdio.h>
|
||
|
||
main()
|
||
{
|
||
int c;
|
||
|
||
clrscr(); // clear screen
|
||
printf("Press a key");
|
||
for(;;)
|
||
{
|
||
c=getchar();
|
||
clrscr();
|
||
printf("%c: %s letter",c,isalpha(c)?"is":"not");
|
||
}
|
||
return 0; // just to avoid warnings by compiler
|
||
}
|
||
</code></pre>
|
||
相关函数:<a href="isalnum.html">isalnum</a>,<a href="isdigit.html">isdigit</a>,<a href="isxdigit.html">isxdigit</a>,<a href="iscntrl.html">iscntrl</a>,<a href="isgraph.html">isgraph</a>,<a href="isprint.html">isprint</a>,<a href="ispunct.html">ispunct</a>,<a href=isspace.html">isspace</a>
|
||
|