SHARE
TWEET

isLetter

Archon Aug 5th, 2012 21 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int isLetter(int *c){
  2.    static int upperLowerDiff = 'a' - 'A';
  3.  
  4.    //A-Z: make lower-case and return 1
  5.    if (*c <= 'Z' && *c >= 'A'){
  6. #ifndef CASE_SENSITIVE
  7.       *c += upperLowerDiff;
  8. #endif
  9.       return 1;
  10.    }
  11.  
  12.    //a-z, apostrophe: return 1
  13.    if (*c >= 'a' && *c <= 'z' || *c == '\'')
  14.       return 1;
  15.  
  16.    //non-letter: return 0
  17.    return 0;
  18. }
RAW Paste Data
Want to get better at C?
Learn to code C in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top