Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a solid understanding of C-strings, and how each std::string object is a wrapper around a C string Practice with pointer operations in C++, e.g.

  • Develop a solid understanding of C-strings, and how each std::string object is a wrapper around a C string

  • Practice with pointer operations in C++, e.g. dereferencing, treating them as arrays (and vice versa), etc.

  • You may not use any #include directives. Rather, take this opportunity to write pure C++, without the use of any library functions/classes/etc.

/** * Reverses a C-string in place (i.e., modifies the string itself). * * @param str the string to reverse * @return a pointer to the reversed string */ char *strrev(char *str) { // TODO } /** * Finds the first occurrence of the substring needle in the C-string haystack. The terminating null * chars ('\0') are not compared. * * @param haystack the string in which to search * @param needle the string for which to search * @return a pointer to the beginning of the located substring, or nullptr if the substring is not * found. */ const char *strstr(const char *haystack, const char *needle) { // TODO }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions