Question: can anyone help me. whats wrong with my code. fix it please. here is my code// h27.cpp ----------------- #include #include #include #include #include // Other
can anyone help me. whats wrong with my code. fix it please.


here is my code//\
h27.cpp
-----------------
#include
// Other headers if necessary using namespace std;
#include "h27.h"
// Add your code here void reverse(char * s) { char * strptr = s; char * beg = s; char * end = &s[0]; char * ch;
while(*end != '\0') { end++; } end--;
while(beg
} cout
//h27.h
#ifndef H27_H_ #define H27_H_
/** * Reverses the C-style string pointed to by s. * * @param s a pointer to the character in a C-style string. * * NOTE: for this assignment, you can only use ++, --, * = (assignment), ==,!= (comparison) and pointer subtraction * (p1 - p2). You cannot use pointer arithmetic (s + i), or * array notation (s[i]). In fact, you cannot have ANY integer * variables or literals in your code. You also cannot use ANY * standard library functions including strlen. */ void reverse(char * s);
#endif // DO NOT CHANGE ANY OF THESE LINES #define strlen(s) static_assert(false, "strlen not allowed"); #define strcat(d, s) static_assert(false, "strcat not allowed"); #define strcpy(d, s) static_assert(false, "strcpy not allowed"); #define string static_assert(false, "string not allowed");
Your Turn There are two assignments for this chapter. To complete these, follow along with the examples in the preceding section, and apply them to these problems. Problem 1 For the first problem, upload the starter code (H27) to your workspace. Then read through the instructions here to write the reverse() function. The function reverses (in place) a C-style character string s. You must use pointers and the increment and dec- rement operators only Do not use pointer arithmetic (that is p n) or array notation in your function. (In oth er words, there will be no int variables or literals in your function: only pointers along with assignment, comparison, pointer subtraction, + and/or - - you may, of course, use a temporary char variable, which you'l need to exchange the elements of the string and a temporary pointer) If you get stuck, please ask questions on Piazza
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
