Question

To replicate strcpy() function of string.h header file

27 Apr 2023
Answer :
Word Count : 284

To replicate the strcpy() function from the string.h header file, you can write a custom function that copies a null-terminated string from the source to the destination. Here's an example implementation in C:


#include <stdio.h>

char* my_strcpy(char* destination, const char* source) {
    char* ptr = destination;
    
    while (*source != '\0') {
        *ptr++ = *source++;
    }
    
   

____ ________ _______ ________ ________ ______ __________ _______ __________ _______.
_________ __________ _________ ______ _________ _______ _____ ____ ________.
___ ______ _______ _______ __________ ________.
____ _____ _________ ________ _______ ____ _____ _______ ________ _________ ______.
______ ______ __________ _________ _____ _______ ________ _________ ____ __________.
_____ _________ ____ ____ ___ ____ ______ ______ ______.
______ _______ __________ _________ ________.
_____ _____ _______ ________ ___ _____ _________ ________ _______ _______ ______ ________.
___ __________ _____ _____ ______ __________ __________ __________ ____ ______ ____ ________.
______ ______ ________ ______ _____ ____ _____ ___ ____ __________ _____.
________ ______ _______ ________ ________ ________ _____ ___ _________ _________.
_____ ___ ________ _______ _____ ______ __________.
_________ ______ _______ _______ ________ ___.
_______ _______ __________ ___ ______ _____ ______ _________ _______ _______ ___.
______ _______ ___ ___ _______ ___.
________ __________ ______ ________ _____ _______ ______ ____.
____ _______ __________ ___ ______.
_______ __________ ____ _______ ___ _______ ___ ________ _________.
__________ ____ ______ ___ __________ ________ _____.
______ _______ _______ _______ __________ ___ ________ _____ ________ ________ _____.
_______ _________ ___ ___ _____ ____ ___ ____.
_____ _____ _________ _____ ______ _____ __________ ___ ____ __________.
________ ___ ________ ______ ________.
_________ ___ _____ ___ _____ ___.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCSL 205 2022 2023 - To replicate strcpy() function of string.h header file | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→