Lets see how can we copy a source string to destination string without using library functions.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzbOvyXlU-sxeZsDfMm5GquDxJgk8NSBBdFNKmp-hTkiKS5Aquo-ytLB_Bc2oleuhBS0nbKEka1fKVu72xYVRwR8ePZKMkXmlMtyr2pmWaOIm8yS2HcFDVC11IVInPCEwVECQUnhSvzDc/s400/copy_str.png)
Code
#include<stdio.h>
int main()
{
char source[20],dest[20];
int i;
printf("\nEnter source string : ");
gets(source);
for(i=0;source[i]!='\0';i++)
dest[i] = source[i];
dest[i] = '\0';
printf("\nCopied String = %s",dest);
return 0;
}
O/P
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzbOvyXlU-sxeZsDfMm5GquDxJgk8NSBBdFNKmp-hTkiKS5Aquo-ytLB_Bc2oleuhBS0nbKEka1fKVu72xYVRwR8ePZKMkXmlMtyr2pmWaOIm8yS2HcFDVC11IVInPCEwVECQUnhSvzDc/s400/copy_str.png)
No comments:
Post a Comment