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


Please Help Members By Posting Answers For Below Questions

What is #include conio h?

594


What does %d do in c?

540


What is the use of define in c?

593


What is the general form of #line preprocessor?

584


Which is best linux os?

561






What is bubble sort in c?

633


What is #define in c?

620


What is the difference between scanf and fscanf?

661


What is the use of typedef in structure in c?

542


What is a floating point in c?

600


which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above

1417


What is difference between far and near pointers?

607


What is pragma in c?

624


Why doesnt that code work?

600


hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .

1900