0
Why is strrev not working in C ? It's showing an error when using it
String functions
4 Réponses
+ 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;}
+ 2
How do you use it?Code example plz.
+ 1
strrev is non standard and deprecated function. So dont work on modern compilers.. Here also not work.
- 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);
}