fork(1) download
  1. #include <stdio.h>
  2. #include <ctype.h>
  3.  
  4. int isLegal (char * theString);
  5.  
  6. int main ()
  7. {
  8. char maybe[] = {"sch"};
  9. int result;
  10.  
  11. result = isLegal (maybe);
  12.  
  13. printf("The result is: %i", result);
  14.  
  15. }
  16.  
  17. // **************************************************
  18. // Function: isLegal
  19. //
  20. // Description: Determines if a word is legal
  21. //
  22. //
  23. // Parameters: theString - the word to be checked
  24. //
  25. // Returns: answer - 0 is illegal, 1 is legal
  26. //
  27. // ***************************************************
  28.  
  29. int isLegal (char theString[])
  30. {
  31. char * word = theString;
  32. int answer = 0;
  33.  
  34. for (word; *word != '\0'; word++)
  35. {
  36.  
  37. *word = toupper(*word);
  38.  
  39. if (*word == 'A' || *word == 'E' || *word == 'I' || *word == 'O' || *word == 'U' || *word == 'Y')
  40. {
  41. answer = 1;
  42. }
  43. }
  44. return (answer);
  45. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
The result is: 0