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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!