code for copying two strings with out strcpy() function.
Answer Posted / ankitecian
int main(int argc, char *argv[])
{
char _output[200];
memset(_output,'\0',200);
if(argc < 2)
{
printf("Usage: <%s> <String -1>\n",argv[0]);
return -1;
}
StrCpy(_output,argv[1]);
printf("The Final String is::: \n[%s]\n",_output);
return 0;
}
int StrCpy(char *_output, const char *_input1)
{
int _cntr1 = 0;
while(*(_input1 + _cntr1) != NULL)
{
*(_output + _cntr1) = *(_input1 + _cntr1);
_cntr1++;
}
return 0;
}
Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
What are the 5 elements of structure?
What are the string functions? List some string functions available in c.
What is local and global variable in c?
What is a constant and types of constants in c?
What are actual arguments?
Apart from dennis ritchie who the other person who contributed in design of c language.
Is it cc or c in a letter?
What is conio h in c?
Which one would you prefer - a macro or a function?
What is class and object in c?
Why main is used in c?
How is null defined in c?
Do you have any idea about the use of "auto" keyword?
Is null always equal to 0(zero)?
Why is c called c?