C program to copy one string to another string using while empty Loop.
C program to copy one string to another string using while empty Loop.
#include <stdio.h>
#define MAX 200
int main()
{
char text1[MAX], text2[MAX];
int i;
printf("\n Enter any string: ");
gets(text1);
i = -1;
while(text2[i] = text1[++i]);
printf("\n First string = %s", text1);
printf("\n Second string = %s", text2);
printf("\n Total Number of characters copied = %d", i);
return 0;
}
Output:
Enter any string: c language
First string = c language
Second string = c language
Total Number of characters copied = 10