code for copying two strings with out strcpy() function.
Answer Posted / reachhary
well, we could also have a string accepted at run time by
use of scanf.
To take care of such cases.
char *mystrcpy(char src[])
{
char *dest = NULL;
int indx = 0, len = 0;
if (!src) return dest;
len = strlen(src);
dest = (char *)malloc(sizeof(char) * len + 1);
while (; src[indx] ; dest[indx++]=src[indx]);
dest[indx]='\0'
return (dest)
}
Please do update if any one finds any issue with the code
segment - in terms of any error or any optimisation
| Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
List some applications of c programming language?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
How are strings stored in c?
What is the c language function prototype?
What is scope rule of function in c?
please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics
Write a program to print fibonacci series without using recursion?
Describe explain how arrays can be passed to a user defined function
Which function in C can be used to append a string to another string?
How can you allocate arrays or structures bigger than 64K?
What is #line in c?
Explain how do you list a file’s date and time?
Tell me is null always defined as 0(zero)?
How do you define a function?