Question: #include using namespace std; char* copy(char* dest, const char* src) { unsigned int srcLen = 0; unsigned int destLen = 0 while (src[srcLen] != '0')
#include using namespace std; char* copy(char* dest, const char* src) { unsigned int srcLen = 0; unsigned int destLen = 0 while (src[srcLen] != '\0') // get length for src { srcLen++; } while (dest[destLen != '\0') // get lenth ofr dest { destLen++; } if(srcLen > destLen) // if src string is too big for dest to hold return null { return NULL; } else if(srcLen <= destLen) { while() // trying to copy src into dest if it has enough space to do so { dest[]=src[]; } } } // Test cases int main() { return 0; } char* cpy (char* destination, const char* source)
The copy function shall copy one string from source include '\0' to destination and return the copied string. Only can happen if the size of the destination is large enough to store the copied string, else returns NULL.
without using built-in C++ string.
Also, write some test cases in functions with the following name style: [function]length__test_case_[n] where n= test case number
Have enough test cases to show the code properly works.
Please don't use ai generated answers.
Thank you.
I have attempted this question could please help me finish it i have comments to show what I'm doing please don't completely change my code.
#include
using namespace std;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
