Implement Custom strcpy function

Code

#include <stdio.h>

void custom_strcpy(char *dest, const char *src) {
    // Your logic here
    int i=0;
    while(src[i])
    {
        dest[i]=src[i];
        i++;
    }
    dest[i]='\0';
}

int main() {
    char src[101];
    char dest[101];
    fgets(src,101,stdin);
    custom_strcpy(dest, src);
    printf("%s", dest);
    return 0;
}

Solving Approach

 

 

 

Upvote
Downvote
Loading...

Input

firmware

Expected Output

firmware