0
#include <stdio.h> int main() { int i,n; char a[100]; gets(a); n=strlen(a); for(i=0;i<=n;i++) { printf("%s",a[n-i]); }
What is the mistake
2 Antworten
+ 3
1. To use string method(strlen) you need to include "string.h" library.
2. Use fgets() instead of gets(). You can learn more about this in C lesson https://www.sololearn.com/learning/2936/
3. a[n-i] means single character not string, so change "%s" to "%c"
Hope this helps!
+ 1
Please follow this guide on how to post a question
https://www.sololearn.com/Discuss/333866/?ref=app