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
What is the method to save data in stack data structure type?
What functions are used for dynamic memory allocation in c language?
What is file in c language?
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)
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
Explain how do you print an address?
Why is main function so important?
What is the general form of a C program?
How can I read in an object file and jump to locations in it?
What is an arrays?
How many types of functions are there in c?
Which header file is used for clrscr?
Explain how can I read and write comma-delimited text?
What does %d do in c?
What is the most efficient way to store flag values?