programming in c code


Question Description

we have only taken loops, if statements, strings, arrays, pointers. make sure to only use these. simple coding for beginners nothing too complex with comments. for this code you need to use string (array of char) and string manipulation functions.


Write a function: void reverse(char * line, char * reversed) that takes data a line at a time and reverse the words of the line. For example, Using the reverse function, write a program which, in a loop:
1. Prompts user to enter a line and reads it from input
2. Passes the string to function reverse
3. Prints out the reversed line
4. Prompts the user to ”do another” by typing ”y”, or to quit the program by typing anything else.
Sample Output: Enter a line: birds and bees The reverse is: bees and birds Do Another (y/n)?y Enter a line: Hello World The reverse is: World Hello Do Another (y/n)?n Press any key to continue

Tutor Answer

School: Rice University

Hello, I will start working on it shortly and submit a complete answer as soon as am done.

void ReverseString(char *s, char *reversed);
void ReverseWords(char *begin, char *end);
char reversed[50];
int length;
int main()
// Prompt user for a sentence
char doanother='Y';
// Wrap with a ...

flag Report DMCA

Top quality work from this tutor! I’ll be back!

Just what I needed… fantastic!

Use Studypool every time I am stuck with an assignment I need guidance.


Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors