strcpy() copy the string in C.

01  #include <stdio.h>
02 #include <string.h>
03
04 int main()
05 {
06 char input_str[10] = "Hello";
07 char output_str[10];
08
09 printf("input_str: %sn", input_str);
10 strcpy(output_str, input_str);
11 printf("output_str: %sn", output_str);
12
13 strcpy(output_str, "students");
14 printf("output_str: %sn", output_str);
15
16 return 0;
17 }
 
 
OUTPUT :

input_str: Hello
output_str: Hello
output_str: students

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.