Q:

C program to copy a string using pointers

0

C program to copy a string using pointers

Function to copy a string using pointers.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

void copy_string(char *target, char *source) {
   while (*source) {
      *target = *source;
      source++;
      target++;
   }
   *target = '\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.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now