#include <stdio.h>
#include <string.h>
// Copy using strcpy
#define LEN 64
int main(void)
{
char s1[LEN] = "";
char s2[] = "Programming is fun";
char s3[LEN] = "";
char s4[LEN] = "";
// Copy s2 into s1
strcpy(s1, s2);
printf("s1 = %s | s2 = %s\n", s1, s2);
// Copy a literal string into s3
strcpy(s3, "Write code in C is fun");
printf("s3 = %s\n", s3);
// Demonstrate strcpy return value
printf("s4 = %s\n", strcpy(s4, "strcpy returns the destination buffer"));
return 0;
}
/*
run:
s1 = Programming is fun | s2 = Programming is fun
s3 = Write code in C is fun
s4 = strcpy returns the destination buffer
*/