write a string copy function routine?

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
void str_cpy(const char *,const char *);
void main()
{
char a[20],b[20];
printf("enter the string for a[] :");
gets(a);
str_cpy(a,b);
printf("\nthe string for b[] is : ");
puts(b);
getch();
}

void str_cpy(const char *a,const char *b)
{
while((*a)^'\0')
{
*b=*a;
*a++;
*b++;
}
*b='\0';
}


thank u

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is it possible to pass an entire structure to functions?

768


How do I use void main?

840


What is this infamous null pointer, anyway?

787


Explain the use of keyword 'register' with respect to variables.

806


What does char * * argv mean in c?

806


What are the three constants used in c?

731


What is the purpose of sprintf() function?

807


why we wont use '&' sing in aceesing the string using scanf

2068


What is the difference between strcpy() and memcpy() function in c programming?

846


What is masking?

905


What is c language and why we use it?

804


List the different types of c tokens?

826


Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

881


how to construct a simulator keeping the logical boolean gates in c

1993


What is a method in c?

814