Is the question bugged? (Extraterrestrials) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is the question bugged? (Extraterrestrials)

I made this for the extraterrestrials problem, it looks correct, yet it says its incorrect: ----------- #include <stdio.h> #include <string.h> int main() { char wrd[50]; int x; scanf("%s",wrd); for (x = strlen (wrd);x >= 0; x--) { printf ("%c",wrd[x]); } return 0; } -----------

19th Feb 2020, 11:41 AM
Carlos Santos
Carlos Santos - avatar
2 Answers
+ 3
x = strlen(wrd)-1 This is the first letter you want to print!
19th Feb 2020, 11:45 AM
HonFu
HonFu - avatar
+ 3
Arrays follow zero indexing. char word[50] means it can store values from index 0 to 49.
19th Feb 2020, 11:49 AM
Avinesh
Avinesh - avatar