Why is strrev not working in C ? It's showing an error when using it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is strrev not working in C ? It's showing an error when using it

String functions

19th Aug 2020, 5:37 PM
A K
A K - avatar
4 Answers
+ 3
In solo strrev function not working do remove it and try in other way once check it this example. int main() { char string[] = "String Reverse"; char reversedStr[strlen(string)]; int j = 0; for(int i = strlen(string)-1; i >= 0; i--){ reversedStr[j++] = string[i]; } reversedStr[j] = '\0'; printf("Original string: %s", string); printf("\nReverse of given string: %s", reversedStr); return 0;}
20th Aug 2020, 12:12 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
How do you use it?Code example plz.
19th Aug 2020, 6:02 PM
HBhZ_C
HBhZ_C - avatar
+ 1
strrev is non standard and deprecated function. So dont work on modern compilers.. Here also not work.
19th Aug 2020, 6:30 PM
Jayakrishna 🇮🇳
- 1
HBhZ_C My code is : #include <stdio.h> #include<string.h> int main() { char string[100]; printf("Enter a string:\n"); scanf("%s",string); strrev(string); printf("The reverse string is :%s",string); }
20th Aug 2020, 1:26 AM
A K
A K - avatar