Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdbool.h>
- bool alphanumeric(const char* string) {
- // empty string
- if (string[0] == 0)
- return false;
- while(*string) {
- char c = *string++;
- if (
- (c < '0' || c > '9')
- && (c < 'A' || c > 'Z')
- && (c < 'a' || c > 'z')
- ) return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment