isdigit()函数用法

/* ************************************************************************
* Filename: main.c
* Description:
* Version: 1.0
* Created: 2011年07月26日 12时27分27秒
* Revision: none
* Compiler: gcc
* Author: YOUR NAME (),
* Company:
* ***********************************************************************
*/

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

int main()
{
char str[] = "123adf545a65d45kk*(&(*";

printf(
"this str:%s\n",str);
int i;
for(i = 0;str[i] != 0;i++)
{
if(isdigit(str[i]))
{
printf(
"%c is the digit number!\n",str[i]);
}
}

return 0;
}

  

原文地址:https://www.cnblogs.com/hnrainll/p/2117069.html