Question: Write a program in c++ that reverses the C-style string pointed to by s. * * @param s a pointer to the character in a

Write a program in c++ that 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.

cpp file:

#include using namespace std;

#include "h27.h"

void reverse(char * s)

{

// Add your code here

}

This is the implementation file:

#ifndef H27_H_ #define H27_H_

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");

Can someone do this and explain your steps please? Thanks.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!