hi guys. im a newbie with regards to C. we were given a code that takes an input, removes vowels and leaves only a space from the input and prints the output. here's the code:
I have a few questions about this code.
1)what does last_c and '\O' stand for? what do they do?
2) whats also the use of '\n' in the getchar?
3)what does d stand for?
4)Is there anyway to emulate the program with the use of only basic functions and loops?
Wish that someone can explain the logic of the code for me. I'm really having a hard time with C. Thanks to all that would help.
Code:
#include<ctype.h> #include<stdio.h> void remove_vowel(char x;char y; char z; char v; char u) { int c, last_c = '\O'; int d; d = 1; while((c=getchar()) != '\n') { if (c == '\n'){ if (last_c != '\n') putchar(c) } else if (c !=x && c !=y && c !=z && c !=u && c !=x && c !='') putchar(c); else if (c == '' && d == 1) { ++d; putchar(c); last_c =c; } } printf("\n") } int main(void) { char a,e,i,o,u; remove_vowel(char 'a';char 'e';char 'i';char 'o';char 'u';) return(0); }
1)what does last_c and '\O' stand for? what do they do?
2) whats also the use of '\n' in the getchar?
3)what does d stand for?
4)Is there anyway to emulate the program with the use of only basic functions and loops?
Wish that someone can explain the logic of the code for me. I'm really having a hard time with C. Thanks to all that would help.
Comment