strrev function in C Programming

4 years, 6 months ago C Programming

strrev function is defined in string.h header file. It reverses a given string. Its basic form is given below:

strrev(str);

Here str, a string, is a parameter of strrev() function. This function reverses this string. Please consider the following program:

#include <stdio.h>
#include <string.h>

int main()
{
 char str[100];
 gets(str);
 puts(strrev(str));
 return 0;
}

Input:

coder

Output:
redoc

By using this program I mean strrev function, you can reverse any number or string. Hope you have understood the use of strrev function in C programming. Happy Coding!!!

Previous Next
Comments
Have you read the comment guideline?

Give me useful, constructive criticism. Spot a typo or an error? Let me know and I will correct it.