Copy one string to another string without liberty function
#include<stdio.h>
main()
{
char string1[80],string2[80];
int i;
printf("Enter the line: ");
printf("\t");
//gets(string2);
scanf("%s",string2);
for(i=0;string2[i]!='\0';i++)
string1[i]=string2[i];
//string1[i]='\0';
printf("\n\%s\n",string1);
printf("\nNumber of charcter is: %d\n",i);
}
#include<stdio.h>
main()
{
char string1[80],string2[80];
int i;
printf("Enter the line: ");
printf("\t");
//gets(string2);
scanf("%s",string2);
for(i=0;string2[i]!='\0';i++)
string1[i]=string2[i];
//string1[i]='\0';
printf("\n\%s\n",string1);
printf("\nNumber of charcter is: %d\n",i);
}
No comments:
Post a Comment