xxxxxxxxxx
char ch = '1';
if(isdigit(ch))
printf("numeric");
else
printf("alphabet" );
// output: numeric
CCopy
xxxxxxxxxx
char ch = '/';
if(isalnum(ch))
printf("numeric or ap=lphabet");
else
printf("other symbol" );
//output: other symbol
CCopy
xxxxxxxxxx
#include <stdio.h>
#include <ctype.h>
int main(void){
char liste[] = "axxg34d2e82";
int status = 0;
for(int i=0;liste[i]!='\0';i++)
{
if (status==1){break;}
while(isdigit(liste[i])){
printf("%c", liste[i]);
if(isdigit(liste[i+1])){
status = 1;
}
i++;
}
}
return 0;
}
xxxxxxxxxx
char ch = '1';
if(isdigit(ch))
printf("numeric");
else
printf("alphabet" );