LordMZTE

Untitled

Jun 9th, 2023
1,092
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdbool.h>
  2.  
  3. bool alphanumeric(const char* string) {
  4.   // empty string
  5.   if (string[0] == 0)
  6.     return false;
  7.  
  8.   while(*string) {
  9.     char c = *string++;
  10.     if (
  11.       (c < '0' || c > '9')
  12.       && (c < 'A' || c > 'Z')
  13.       && (c < 'a' || c > 'z')
  14.     ) return false;
  15.   }
  16.  
  17.   return true;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment