Ticker

6/recent/ticker-posts

C Language (strcpy function)

STRCPY FUNCTION IN C

The strcpy function is used to copy one string variable's value in another string variable.





STRCPY() FUNCTION EXAMPLE
#include<stdio.h>
#include<string.h>
#include<conio.h>
void main()
{
clrscr();
char a[60], b[60];
puts("Enter any sentence: ");
gets(a);
strcpy(b, a);

// Print values of string variable A and B
printf("\n- - - Value of string variable A - - -\n");
printf("%s", a);


printf("\n- - - Value of string variable B - - -\n");
printf("\n%s", b);
getch();
}


----------------------------
         OUTPUT 
----------------------------

Enter any sentence:
Computer is an electronic device

Value of string variable A
Computer is an electronic device

Value of string variable B
Computer is an electronic device

















HOME

Post a Comment

0 Comments