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

Do you know what are the properties of union in c?

0 Answers  


What is const keyword in c?

0 Answers  


How many main () function we can have in a project?

0 Answers  


Describe explain how arrays can be passed to a user defined function

0 Answers  


What is the difference between printf and scanf )?

0 Answers  






Sir i want e-notes of C languge of BAlaguruswami book i.e scanned or pdf file of balaguruswamy book on c language.PLEASE SEND ME on my mail id ajit_kolhe@rediff.com

8 Answers  


How can I do serial ("comm") port I/O?

0 Answers   Celstream,


Do you have any idea about the use of "auto" keyword?

0 Answers  


what are the 10 different models of writing an addition program in C language?

0 Answers  


what is difference between getchar,putchar functions and printf and scanf function? does putchar show output only when input given to it

5 Answers   DIT,


Does c have circular shift operators?

0 Answers  


What does c value mean?

0 Answers  


Categories