Reverse a string program in C

Reverse a string program in C. We will learn how to reverse a given String in this lesson. The output should be “plppa” if the string is “apple.” This notion can be used to check the palindrome. Because the value of the palindrome string remains the same even after it is reversed.

In C, a string (sometimes referred to as a C string) is an array of characters followed by a NULL character. A set of characters is contained within double quotations to represent a string (“).

#include <stdio.h>
int main()
char str[1000], rev[1000];
int i, j, value = 0;
scanf("%s", str);
printf("\nReverse the string %s", str);
while (str[value] != '\0')
j = value - 1;
for (i = 0; i < value; i++)
rev[i] = str[j];

printf("\nString after reversed %s", rev);



Reverse the string inlarn
String after reversed nralni

What is string in c program

A string is a data type similar to an integer and a floating-point unit that is used to represent text rather than numbers in programming. The words “food” and “I have 3 food,” for example, are both strings. If provided correctly, even “12345” may be deemed a string.

How to calculate string length in c

The number of characters typed in the String is returned by the string length method. This function calculates the length of any string by counting the number of 16-bit Unicode characters in the string. In the C programming language, a string is an array of characters that ends with a null character (\0). The length of a string is the number of characters in it. A character is not counted when the string length is ‘0.’ 

What is strrev function in c program

The strrev() function is specified in the string. h header file and is a built-in function in C. To reverse the given string, use the strrev() method. char *strrev(char *str);