#include <stdio.h>
void copy_string(char [], char []);
int main() {
char s[1000], d[1000];
printf("Input a string\n");
gets(s);
copy_string(d, s);
printf("The string: %s\n", d);
return 0;
}
void copy_string(char d[], char s[]) {
int c = 0;
while (s[c] != '\0') {
d[c] = s[c];
c++;
}
d[c] = '\0';
}
Output of the program:
Before copying, the string: What can I say about my programming skills? Input a string to copy My programming skills are improving. After copying, the string: My programming skills are improving.
Output of the program:
Input a string to copy
My programming skills are improving.
After copying, the string: My programming skills are improving.