Question
We Saw The Following Code In Lctr 8. Void Strcpy_c(Char *Dst, Char *Src) { Count--; // Global Var For The Number Of Char To Copy
We Saw The Following Code In Lctr 8. Void Strcpy_c(Char *Dst, Char *Src) { Count--; // Global Var For The Number Of Char To Copy Uint8_t Temp; While(Count) { Temp =
We saw the following code in Lctr 8.
void strcpy_c(char *dst, char *src) { count--; // global var for the number of char to copy uint8_t temp; while(count) { temp = *src++; *dst++ = temp; count--; } *dst = 0; }
Revise this function according to the following requirements: Copy the string without using the global variable count ; terminate the copy using the standard termination of the source string. In addition to the string copy, return the length of the source string, defined as the true length of the displayable string, not including the terminating char. You cannot call a function to calculate the length in the code. Define it as int len and do the calculation by yourself. You should try to use fewer lines without affecting the readability. The prototype of the function should be int strcpy_len(char *dst, char *src);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started