fork download
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<string.h>
  4. #define TRUE 1
  5. #define FALSE 0
  6.  
  7. int check_vowel(char);
  8.  
  9. main()
  10. {
  11. char string[100], *temp, *pointer, ch, *start;
  12.  
  13. printf("Enter a string\n");
  14. gets(string);
  15.  
  16. temp = string;
  17. pointer = (char*)malloc(100);
  18.  
  19. if( pointer == NULL )
  20. {
  21. printf("Unable to allocate memory.\n");
  22. exit(EXIT_FAILURE);
  23. }
  24.  
  25. start = pointer;
  26.  
  27. while(*temp)
  28. {
  29. ch = *temp;
  30.  
  31. if ( !check_vowel(ch) )
  32. {
  33. *pointer = ch;
  34. pointer++;
  35. }
  36. temp++;
  37. }
  38. *pointer = '\0';
  39.  
  40. pointer = start;
  41. strcpy(string, pointer); /* If you wish to convert original string */
  42. free(pointer);
  43.  
  44. printf("String after removing vowel is \"%s\"\n", string);
  45.  
  46. return 0;
  47. }
  48.  
  49. int check_vowel(char a)
  50. {
  51. if ( a >= 'A' && a <= 'Z' )
  52. a = a + 'a' - 'A';
  53.  
  54. if ( a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
  55. return TRUE;
  56.  
  57. return FALSE;
  58. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
cc1: warnings being treated as errors
prog.c:10: error: return type defaults to ‘int’
stdout
Standard output is empty