Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function called StringToCharBuffer that Takes 2 parameters: a string and a pointer to a pointer to a character. Must dynamically allocate a character

Write a function called StringToCharBuffer that
Takes 2 parameters: a string and a pointer to a pointer to a character.
Must dynamically allocate a character array big enough to store the string (and it's null terminator character) and "return" the array through the pointer to a pointer 2nd parameter
Populate the dynamically allocated character buffer with characters from the first string parameter in reverse order
Use some form of pointer incrementor or pointer arithmetic
The function should work with the following main() code:
int main()
{
char* p;
string s ="!kcoR sredoC";
StringToCharBuffer(s, &p);
cout << p << endl;
delete[] p;
return 0;
}
Submit your *.cpp file and vcxproj file zipped up (Mac users can just submit their *.cpp file).

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

LO6 Describe how to choose among the recruitment sources.

Answered: 1 week ago