C Programming - Strings - Discussion

Discussion Forum : Strings - General Questions (Q.No. 7)
7.
The library function used to reverse a string is
strstr()
strrev()
revstr()
strreverse()
Answer: Option
Explanation:

strrev(s) Reverses all characters in s

Example:

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

int main(void)
{
   char *str = "IndiaBIX";

   printf("Before strrev(): %s\n", str);
   strrev(str);
   printf("After strrev():  %s\n", str);
   return 0;
}

Output:

Before strrev(): IndiaBIX

After strrev(): XIBaidnI

Discussion:
2 comments Page 1 of 1.

Chandrasekhar said:   1 decade ago
It doesn't compile there is no use of pointers in this program.

Vinoth said:   1 decade ago
In this program What is the use of pointer?

Post your comments here:

Your comments will be displayed after verification.