+ 1

Please help me DEBUG this code

#include <stdio.h> #include<string.h> int main() { char s[100]; scanf("%s",s); int l= strlen(s); for(int i=0; i<l; i++){ if(s[i]=='a'||'e'||'i'||'o'||'u'||'A'||'E'||'I'||'O'||'U'){ s[i]=''; // Here it is throwing an error. If i place s[i]='k'; , o/p: kkkk } } printf("%s",s); return 0; }

26th Dec 2019, 4:00 PM
Tom
Tom - avatar
3 ответов
+ 1
Yeah, I tried that. In that case, I am getting No Output The problem is my program is treating every character as a vowel. But I am cant realize how to solve it.
26th Dec 2019, 5:25 PM
Tom
Tom - avatar
+ 4
First you should know what is empty character constant then you can solve it.
26th Dec 2019, 4:21 PM
A͢J
A͢J - avatar
+ 4
x=='a'||'b' does not work - you have to write x=='a'||x=='b' etc. Or you go for another solution, for example a switch or a loop. (There are other issues, but first try and see if you can get it going alone from here.)
26th Dec 2019, 6:02 PM
HonFu
HonFu - avatar