|
This is the
program to reverse the given string and display. The program
internally uses the logic of reversing the word.
Logic:
The approach here is to reverse the string using
the pointers. Reversing the string includes the reversing the each and every
words in it. After accepting a string from user, it calls a function "strev"
with two string pointer arguments, the source and destination. It has an
iterative loop, which traces from the EOL through the beginning. Each time it
copies the current letter to the destination. Finally it displays the resultant
string.
The earlier program implements
the same by direct method, i.e. without pointers. |