How to write a c program to copying a string in c programming ?
Solution:
#include <stdio.h>
void stringCopy(char str1[], char str2[]);
int main()
{
char s1[] = "BUET";
char s2[10];
stringCopy(s1, s2);
printf(s2);
return 0;
}
void stringCopy(char str1[], char str2[])
{
int i;
for(i = 0; str1[i] != '\0'; i++)
str2[i] = str1[i];
str2[i] = '\0';
}