write a string copy function routine?
Answers were Sorted based on User's Feedback
#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 |
Answer / ragu
if we compile in turbo c its showing error like this
in that above code we cant modify a const object in function str_cpy(const char *a,const char *b)
Is This Answer Correct ? | 0 Yes | 0 No |
What do you know about the use of bit field?
How do I get an accurate error status return from system on ms-dos?
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
What is putchar() function?
related proverb of "dont count your chicken before it hatches"
how many argument we can pas in in a function
How do you write a program which produces its own source code as its output?
Find the highest of three numbers and print them using ascending orders?
what is difference between userlevel threads and kernel level threads ?what are the trades offs between these two approaches ? what approach is most frequently used and why ?
What is #line used for?
What is a pointer value and address in c?
What are different types of pointers?