Why I am unable to use "strrev" for reverse of a string. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why I am unable to use "strrev" for reverse of a string.

#include<stdio.h> #include<string.h> #include<conio.h> int main() { int name[20]; printf("Enter your name:"); gets(&name[0]); strrev(name); puts(name); } It is not compiled. Please help

12th Oct 2020, 6:23 AM
meherDev
meherDev - avatar
5 Answers
+ 5
you can try thisšŸ‘‡ #include <stdio.h> #include <string.h> int main() { char word[30]; scanf ("%s", word); for ( int i = strlen ( word) - 1; i >= 0; i--){ printf ("%c", word[i]); } return 0; }
12th Oct 2020, 6:41 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 6
strrev is non standard and deprecated function. So dont work on modern compilers.. Here also strrev won't work.
12th Oct 2020, 6:35 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 5
Wlcm bro. Happy coding....
12th Oct 2020, 6:53 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 1
Alphin K Sajan thank you very much
12th Oct 2020, 6:51 AM
meherDev
meherDev - avatar
- 1
Alphin K Sajan so, what should I do???
12th Oct 2020, 6:39 AM
meherDev
meherDev - avatar