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

How can I get back to the interactive keyboard if stdin is redirected?

671


WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER

1461


What is unary operator?

661


Explain what is operator promotion?

637


What is New modifiers?

672






What do header files do?

604


Is c language still used?

538


Can a file other than a .h file be included with #include?

686


How many types of sorting are there in c?

614


What is the difference between NULL and NUL?

729


Why is event driven programming or procedural programming, better within specific scenario?

1955


How do you define CONSTANT in C?

654


What is the newline escape sequence?

589


What is a pointer on a pointer in c programming language?

622


Is c# a good language?

613