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

What is the purpose of 'register' keyword in c language?

622


What is the use of f in c?

551


What is const volatile variable in c?

572


What is anagram in c?

510


Which is better pointer or array?

592






Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

696


code for find determinent of amatrix

1511


What is static identifier?

699


Which node is more powerful and can handle local information processing or graphics processing?

819


Explain the difference between strcpy() and memcpy() function?

585


Not all reserved words are written in lowercase. TRUE or FALSE?

719


Why & is used in c?

709


Explain the difference between structs and unions in c?

572


`write a program to display the recomended action depends on a color of trafic light using nested if statments

1629


What is use of bit field?

765