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 |
Do you know what are the properties of union in c?
What is const keyword in c?
How many main () function we can have in a project?
Describe explain how arrays can be passed to a user defined function
What is the difference between printf and scanf )?
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
How can I do serial ("comm") port I/O?
Do you have any idea about the use of "auto" keyword?
what are the 10 different models of writing an addition program in C language?
what is difference between getchar,putchar functions and printf and scanf function? does putchar show output only when input given to it
Does c have circular shift operators?
What does c value mean?