Monday, 5 October 2015

Write a program to copy one string to another string.

  
   
#include<stdio.h>
//#include<conio.h>
void main() {
    char name1[100], name2[100];
    int i = 0;
    //clrscr();
    printf(" Please Give The STRING OF name1 \n:");
    gets(name1);
    while (name1[i] != '\0') {
        name2[i] = name1[i];
        i++;
    }
    name2[i] = name1[i];
    printf("string name1 is : % s\n", name1);
    printf("string name2 is : % s\n", name2);
    //getch();
}
Note: Remove the comment line when you are use Turbo C IDE for run your program.

No comments:

Post a Comment