mirror of
				https://github.com/fofolee/uTools-Manuals.git
				synced 2025-10-25 22:03:08 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <h1>字符函数 - isdigit</h1>
 | ||
| 
 | ||
| 
 | ||
|   <p>原型:extern int isdigit(int c);</p>
 | ||
|   
 | ||
|   <p>用法:#include <ctype.h></p>
 | ||
|   
 | ||
|   <p>功能:判断字符c是否为数字</p>
 | ||
|   
 | ||
|   <p>说明:当c为数字0-9时,返回非零值,否则返回零。</p>
 | ||
|   
 | ||
|   举例:<pre><code class="language-c">
 | ||
| 
 | ||
|       // isdigit.c
 | ||
|       
 | ||
|       #include <syslib.h>
 | ||
|       #include <ctype.h>
 | ||
| 
 | ||
|       main()
 | ||
|       {
 | ||
|         int c;
 | ||
|         
 | ||
|         clrscr();        // clear screen
 | ||
|         c='a';
 | ||
|         printf("%c:%s\n",c,isdigit(c)?"yes":"no");
 | ||
|         c='9';
 | ||
|         printf("%c:%s\n",c,isdigit(c)?"yes":"no");
 | ||
|         c='*';
 | ||
|         printf("%c:%s\n",c,isdigit(c)?"yes":"no");
 | ||
|         getchar();
 | ||
|         return 0;
 | ||
|       }
 | ||
|       
 | ||
|   </code></pre>相关函数:<a href="isalnum.html">isalnum</a>,<a href="isalpha.html">isalpha</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>
 | ||
| 
 |