How to reverse a given string code example
Example 1: code to reverse a string
#include <stdio.h>
#include <string.h>
int main()
{
char s[100];
printf("Enter a string to reverse\n");
gets(s);
strrev(s);
printf("Reverse of the string: %s\n", s);
return 0;
}
Example 2: reverse a string
let t = s.chars().rev().collect::<String>();