(USING CODEBLOCKS)
Write a program that given two character strings from the user:
Checks these two character strings to see if one string is the reverse of the other.
If the strings are reverse, display: “Reverse Strings Found”, otherwise display: “Reverse Strings Not Found”.
Create a function to perform this task.

1
Expert's answer
2014-12-10T13:15:23-0500
#include <stdio.h> #include <cstdlib> using namespace std; int revCheck( char *s_1, char *s_2 ) { int length = 0; while ( *s_2 != '\0' ) /* loop sets the pointer of 2th string to the end of the string*/ { s_2++; } s_2--; /* exclude '0' */ while ( *s_1 != '\0' ) /* reverse check loop */ { if ( *s_1 != *s_2 ) /* continue loop until the first mismatch occurs */ { printf("Reverse String Not Found\n"); return 0; /* return from func */ } s_1++; /* increment pointer of 1th string */ s_2--; /* decrement pointer of 2th string */ }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment