CPlusOOP
SiteMap
Building C++ Classes
Programming C++
Pointers/Memory Allocation
«Prev
Function Prototypes
C++ Core
Convert C program--> C++
Basic C++ Quiz
Similarities in C/C++
Using IO Stream - Exercise
Scope of Function
Functions Variables - Conclusion
Functions Scope - Quiz
Anonymous Namespaces
Pointers Memory Allocation
C++ const keyword
const pointer argument
reference Declarations
Call by Reference
C++ Generic Pointer
void formal Parameter
Free Store Operators
C++ new Operator
C++ delete Operator
Dynamic Array
Dynamic multi-dimensional
array allocation Function
array deallocate Function
findmax Function
C++ main function
memory Allocation Conclusion
Pointers Memory Allocation - Quiz
New Storage Allocation - Exercise
Using storage allocated with new
Objective:
Write a function that performs string reversal using storage allocated with
new
.
Instructions
Assume that
s1
ends up with the reverse of the string
s2
.
Use
new
to allocate
s1
of length
strlen(s2) + 1
, which is adequate store of
s1
.
char* strrev(char*& s1, const char* s2);
Paste the source code of your function below and click the
Submit
button when you are ready to submit this exercise.
Submit