Question: String manipulation functions are often vulnerable to ill-formed C strings: character arrays that lack string terminators. Write a protected version of copyString that transfers at
String manipulation functions are often vulnerable to ill-formed C strings: character arrays that lack string terminators. Write a protected version of copyString that transfers at most n 1 characters from in to out and always writes a string terminator to out.
I m not good at this kind of the question. please help with this code and write in C language that could run in VM. thanks
1 Copies at most n-1 ch aracters of string in into the 2 buffer pointed to by out If n i s reached, re turns -2. 3 Otherwise returns -1 for ma forme d input and O upon 4 successful completion 6 int copy String N char in, char out int n) Implement a unit test of copyStringN in a main function that exercises its full protective functionality
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
