My Subject Blog

C Program to String Copying

/*
Write a program to copy one string to another string
*/

#include <stdio.h>

int main(void) 
{
char str1[50],str2[50];
int i;
printf("Enter First String :");
scanf("%[^\n]s",str1);
for(i=0;str1[i]!='\0';i++)
{
str2[i]=str1[i];
}
str2[i]='\0';
printf("Copied String = %s",str2);
return 0;
}

Comments

Most Visited Post

C Program to Find Largest Odd Number from Array

Followers