strncpy Function

#include<stdio.h>
#include<string.h>
int main()
{
    int n;

    char anik[50], rob[50];

    printf("Enter First String : ");
    gets(anik);

    printf("Enter Second String : ");
    gets(rob);

    printf("Enter number which number copy in First String : ");
    scanf("%d", &n);

    strncpy(anik, rob, n);

    printf("\nAfter Copy : ");
    printf("%s\n", anik);


    return 0;
}

Comments