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 |
All technical questions
Process by which one bit pattern in to another by bit wise operation is?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
Why header file is used in c?
what is the code to display color fonts in the output?
What are the advantages of the functions?
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555
What is pointer to pointer in c with example?
1. What will be the output of the following programs. a) #include <stdio.h> Main() { Int x=4; While(x==1) { X=x-1; Printf(“%d”,x); --x; } }
Differentiate between ordinary variable and pointer in c.
where do we use structure pointer?
what are bit fields? What is the use of bit fields in a structure declaration?
0 Answers Flextronics, TISL, Virtusa,