Please I need help i have this final to turn in tomorrow.i recall in the past i wrote a similar program like this all so i need somebody to lead me into changin this program so that it can fit the requirement of my assignment.
My requirement is assignmet is: I need to write a function which is to input a phrase one or more words on a single line ) and then display the phrase in reverse order -note that you must handle the inputof spaces.
It then to search the original phrase to see if the word "junk" is in and output a message stating if it is or not and if it is, its location in the phrase .
Attached is the program is wrote few day ago. How can i change this to fit my the requirement of the program.
void rev(char *l, char *r);
int main(int argc, char *argv)
char buf = "the world will go on forever";
char *end, *x, *y;
// Reverse the whole sentence first..
for(end=buf; *end; end++);
// Now swap each word within sentence...
x = buf-1;
y = buf;
while(x++ < end)
if(*x == '\0' || *x == ' ')
y = x+1;
// Now print the final string....
// Function to reverse a string in place...
void rev(char *l,char *r)
t = *l;
*l++ = *r;
*r-- = t;