Previous Reference C++ Reference <cstring> Next Reference





C++ Reference: strcpy()





strcpy()


Declaration

char* strcpy(char* cpDest, const char* kcpSrc);

Description

This function copies the bytes from the null-terminated string "kcpSrc" to the destination "cpDest." The strings must not overlap.

Example

#include <cstdio>
#include <cstring>

int main()
{
    char caSource[] = "XoaX.net";
    char caDest[20];
    // Copy the string "XoaX.net"
    strcpy(caDest, caSource);
    printf("Copied: %s\n", caDest);

    return 0;
}


Output:








Previous Reference C++ Reference <cstring> Next Reference





Home | Reference | Play Games! | Forum | Site Map | Contact Us