Search Your Topic

config
Thursday, 22 June 2017 03:10

C Copy String: strcpy()

Written by
Rate this item
(0 votes)

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

 
  1. #include <stdio.h>  
  2. void main()  
  3. {  
  4.    char ch[20]={'t''o''s''h''i''y''a''s''i''t''\0'};  
  5.    char ch2[20];  
  6.    strcpy(ch2,ch);  
  7.    printf("Value of second string is: %s",ch2);  
  8. }  

Output:

Value of second string is: toshiyasit
Read 240 times
Anish Sir

"I am delighted once again to pen the welcome note to the Tosh!Yas Technologies ."

 Call +91 74 88 34 7779  | Email : anishsingh@live.com

toshiyas.in

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.