- 1
Extra terrestrial problem
#include <stdio.h> #include <string.h> int main() { char str[100]; gets(str); int i,length; length=strlen(str); for(i=length;i>=0;i--){ printf("%c",str[i]); } return 0; } This code works in sololearn compiler to reverese a word but does not work in solution code compiler.whats wrong please??
1 Resposta
+ 2
Hello Shafiqul Islam
The index starts at 0. So the last index is length - 1.