code for copying two strings with out strcpy() function.

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
void str_cpy(char *,char *);
void main()
{
char a[30],b[20];
printf("enter the string to be copied :");
gets(b);
str_cpy(a,b);
printf("the final string is :");
puts(a);
getch();
}
void str_cpy(char *a,char *b)
{
if(*b!='\0')
{
*a=*b;
str_cpy(++a,++b);
}
*a='\0';
}

thank u

Is This Answer Correct ?    6 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the method to save data in stack data structure type?

603


What functions are used for dynamic memory allocation in c language?

600


What is file in c language?

574


GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)

678


why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above

608






Explain how do you print an address?

658


Why is main function so important?

613


What is the general form of a C program?

596


How can I read in an object file and jump to locations in it?

575


What is an arrays?

650


How many types of functions are there in c?

581


Which header file is used for clrscr?

577


Explain how can I read and write comma-delimited text?

651


What does %d do in c?

540


What is the most efficient way to store flag values?

685