0
Code Coach: Extra Terrestrials C, failing test case #3
everything is working as expected, except for whatever reason one of the cases is failing can anyone enlighten me as to why this may be? #include <stdio.h> #include <string.h> int main() { char input[30]; int i, len; fgets(input,30,stdin); len = strlen(input); for (i = len - 1; i >= 0; i--) { printf("%c", input[i]); } return 0; }
3 Answers
+ 1
Your program is working perfectly, looks like sololearn is providing input word sizeof which is greater than 30.
Just increase the size of "input" array and it should work ( also don't forget to tell fgets() the same )
Here is the fix đ
https://code.sololearn.com/c182l36fM91V/?ref=app
0
Thank you!
I forgot I even posted this, it passed after changing it to 100
0
Arsenic can u help me in c++?