Extra-terrestrial error in C in 2 of 5 test cases | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Extra-terrestrial error in C in 2 of 5 test cases

It seems everything to be ok to me, but it cant pass 2 of 5 test casses. Can you help me? #include <stdio.h> #include <string.h> int main() { char word[20]; scanf ("%s", word); int leng = strlen(word); int i; for (i=leng-1; i>=0; i--) { printf ("%c", word[i]); } return 0; }

12th Sep 2021, 1:10 PM
Madalina Peter
Madalina Peter - avatar
4 Answers
+ 4
Try with bigger :) you'll pass 👍
12th Sep 2021, 2:03 PM
Daljeet Singh
Daljeet Singh - avatar
+ 4
Madalina Peter Think ,what if word is bigger than what you are accepting?
12th Sep 2021, 1:16 PM
Daljeet Singh
Daljeet Singh - avatar
+ 2
I've tried with a smaller value but it doesn't work.
12th Sep 2021, 1:35 PM
Madalina Peter
Madalina Peter - avatar
+ 2
Now it worked. Thank you very much for your help.
12th Sep 2021, 2:11 PM
Madalina Peter
Madalina Peter - avatar