C program to find given string has alphabets, digits and special characters in it

there are lots of snippets of C code online. google is your friend.

but i didn't find any solution for it

If you know the ascii code,

48-57 0-9
65-90 A-Z
97-122 a-z
Most of the remainder (0-127) are special characters, except space (32) and perhaps other white space characters.

It will consist of one while loop to check each of the above.

For the extended ascii table, see
http://www.ascii-code.com/

To determine if a given string has alphabets, digits, and special characters, you can write a C program that iterates through each character in the string and checks its type using standard library functions. Here's an example program that demonstrates this:

```c
#include <stdio.h>
#include <ctype.h>

int main() {
char str[100]; // assuming maximum string length is 100
int has_alphabet = 0, has_digit = 0, has_special = 0;
int i;

printf("Enter a string: ");
fgets(str, sizeof(str), stdin);

for (i = 0; str[i] != '\0'; i++) {
if (isalpha(str[i]))
has_alphabet = 1;
else if (isdigit(str[i]))
has_digit = 1;
else if (!isspace(str[i]))
has_special = 1;
}

if (has_alphabet)
printf("The string has alphabets.\n");
else
printf("The string does not have any alphabets.\n");

if (has_digit)
printf("The string has digits.\n");
else
printf("The string does not have any digits.\n");

if (has_special)
printf("The string has special characters.\n");
else
printf("The string does not have any special characters.\n");

return 0;
}
```

In this program, we declare three boolean variables `has_alphabet`, `has_digit`, and `has_special`, initialized to 0. We then use a `for` loop to iterate through each character of the given string.

Inside the loop, we use the `isalpha` function from the `ctype.h` library to check if each character is an alphabet. If so, we set the `has_alphabet` variable to 1.

Next, we use the `isdigit` function to check if the character is a digit. If yes, we set the `has_digit` variable to 1.

Finally, we use the `isspace` function to check if the character is a white space character. If not, and the previous conditions were not met, then we consider the character as a special character and set the `has_special` variable to 1.

After looping through all characters, we use `if-else` statements to print the appropriate messages based on the values of `has_alphabet`, `has_digit`, and `has_special` variables.

Note: The `fgets` function is used to read the string from the user, and it includes the newline character (\n) at the end.