Strcpy

The strcpy(destination, source) function copies the source string in destination.
Syntax :
strcpy(destination, source)
Example :

#include <stdio.h>

int main(void)
{
    char source[20]={'h','e','l','l','o','\0'};
    char destination[20];

    strcpy(destination,source);

    printf("Value of second string is : %s",destination);

    return 0;
}

Output :
Value of second string is : hello

Post a Comment

0 Comments