pTutorial

New way to learn C programming

C Program to copy string

These programs copy the one string to the other string that means one array of a char variable to the other array of char using strcpy and without strcpy. You can see all the code below and also download this code.

Copy from one string to another

#include <stdio.h>
#include <conio.h>
void main()
{
  char z[90], x[90];
 
   printf("Enter 1st string\n");
   gets(z);

   strcpy(x, z);
   printf("Entered string: %s\n", z);
   printf("Copied string: %s\n", x);
 
 getch();  
}

Download Copy String Program

Output of program

 C program copy string

strcpy function simply copies the value of string z into the x.

See Also

Php operator   |   Php types of error   |   Sql query interview questions pdf

QUOTES OF THE DAY

We are never deceived we deceive ourselves.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER