Post Page Advertisement [Top]

C-Programming

What is strcpy() function how to use it easily give example??

What is strcpy() function how to use it easily give example??

strcpy() function:-this function takes two arguments,of which first is a string variable and second can be a  string constant or a variable. it copies the character of the second argument at the end of the first argument..


/* strcpy function example.*/
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{char st1[20],st2[20];
clrscr();
printf("\n enter char string : ");
gets(st1);
printf("\n enter second string : ");
gets(st2);
printf("\n st1 is : %s", st1);
printf("\n st2 is : %s", st2);
strcpy(st1,st2);
printf("\n after coping string the value of st1 is : %s", st1);
getch();
}



DizIT_Operators
Thank-You 




No comments:

Post a Comment

Bottom Ad [Post Page]