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 is the differance between pass by reference and pass by value.
to find out the reverse digit of a given number
6 Answers Infosys, Microsoft, TCS, Wipro,
What is main return c?
What is call by reference in functions?
Where static variables are stored in c?
difference between i++* and *++i
what is c
which of 'arrays' or 'pointers' are faster?
What is the basic structure of c?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
What is difference between array and structure in c?
WHOT IS CHAR?