how can i make the condition if(isalpha(str))
always said that it is invalid conversion from char to int whenever i use if(isalpha(i))
does not print the "That is alpha" help me pls?

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

int main ()
{
int i;
char str[256];

printf ("Enter a number: ");

gets ( str );

i = atoi ( str );
if(isalpha(str))
{
printf("That is Alpha");
}
else
printf("That is digit");
printf ("Value of letter i is %d",i);
system("pause");
}

isalpha() tests only ONE char - not a whole string. You'll need to loop through the entire string with either a pointer, or an array index, to test each value in the string, one at a time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.