1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #include<stdio.h> #include<stdlib.h> #include<string.h> #define TRUE 1 #define FALSE 0 int check_vowel(char); int main() { char string[100], *temp, *pointer, ch, *start; printf("Enter a string\n"); gets(string); temp = string; pointer = (char*)malloc(100); if( pointer == NULL ) { printf("Unable to allocate memory.\n"); exit(EXIT_FAILURE); } start = pointer; while(*temp) { ch = *temp; if ( !check_vowel(ch) ) { *pointer = ch; pointer++; } temp++; } *pointer = '\0'; pointer = start; strcpy(string, pointer); /* If you wish to convert original string */ free(pointer); printf("String after removing vowel is \"%s\"\n", string); return 0; } int check_vowel(char a) { if ( a >= 'A' && a <= 'Z' ) a = a + 'a' - 'A'; if ( a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u') return TRUE; return FALSE; } |
-
upload with new input
-
result: Runtime error time: 0.01s memory: 1856 kB signal: 11 (SIGSEGV)
zxcerdcxzcvercdx euiou pljkm jknmoplkmhiocgbnxcseuihuufghftfgvbcfcvbcxdrfgxcvnntydaswetuiopijknvgtyuioiuhklhcvxfsdfcxzcxzcxtrfeyyuioklnkmcgiofrtesdfsgyuioiohngfdfhuftyikygftytohjghdfyuopiokghderyyuiuopipio
-
result: Success time: 0.01s memory: 1856 kB returned value: 0
erroneouslitic
Enter a string String after removing vowel is "rrnsltc"
-
result: Success time: 0.02s memory: 1856 kB returned value: 0
harini
Enter a string String after removing vowel is "hrn"
-
result: Success time: 0.01s memory: 1856 kB returned value: 0
Enter a string String after removing vowel is ""



