+ 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; }
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.
+ 4
First you should know what is empty character constant then you can solve it.
+ 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.)