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;
}

  

posted @ 2011-07-26 12:31  hnrainll  阅读(1722)  评论(0编辑  收藏  举报