By signing up, you agree to our Terms of Use and Privacy Policy. Forgot Password? This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy.
Popular Course in this category. Course Price View Course. Free Software Development Course. Login details for this Free course will be emailed to you. There are several methods for reversing a string, each of which has a distinct logic. In this chapter, you'll learn how to manually reverse a string using two separate principles, and reasoning without utilizing any preset functions.
When the reverse of a string algorithm is applied in that particular input string, the string sent in a certain sequence by the user to your software is completely reversed. For example, if the string is "hello", the output will be "olleh". This concept can be used to check the palindrome. A palindrome is a string that remains the same when reversed.
So, a palindrome string will have the same value even after we reverse it. C program uses different ways to reverse a string entered by the user. A given string can be reversed in the C language by using strrev function,without strrev, recursion, pointers, using another string, or displaying it in reverse order.
The below given example shows how to reverse a string using two of these methods. As in the above output, we see the given string is printed in reverse order, but actually, it is not updated or edited to the string, just printing it.
As again an output we can see is printed in reverse order, again actually it is not updated or edited to the string. The string is an order collection of characters. We can reverse a string in multiple ways as in the above examples. You can also go through our other related articles to learn more —. Submit Next Question. By signing up, you agree to our Terms of Use and Privacy Policy.
0コメント