write a string copy function routine?

Answers were Sorted based on User's Feedback



write a string copy function routine?..

Answer / vignesh1988i

#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

write a string copy function routine?..

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

Post New Answer

More C Interview Questions

in iso what are the common technological language?

0 Answers  


what is c

1 Answers  


Why c is known as a mother language?

0 Answers  


how can i get the output 54321 4321 321 21 1 in c programming........???? pls help......

10 Answers   Infosys,


What are qualifiers and modifiers c?

0 Answers  






What is an auto keyword in c?

0 Answers  


Explain what are the advantages and disadvantages of a heap?

0 Answers  


In C language, a variable name cannot contain?

0 Answers  


two variables are added answer is stored on not for third variable how it is possible?

3 Answers  


What does sizeof function do?

0 Answers  


#include<stdio.h> #include<conio.h> void main() { float a; clrscr(); a=0.5; if(a==0.5) printf("yes"); else printf("no"); getch(); }

9 Answers   TCS,


what is the difference between getch() and getchar()?

10 Answers   Huawei, Infosys,


Categories