how to copy a string without using c 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 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is realloc in c?

815


What is external variable in c?

805


What is hungarian notation? Is it worthwhile?

943


State two uses of pointers in C?

815


Explain what does it mean when a pointer is used in an if statement?

826


Where static variables are stored in c?

782


Explain the use of 'auto' keyword

872


Does c have enums?

773


What is typedf?

874


What are data types in c language?

794


Why clrscr is used in c?

788


How can I direct output to the printer?

1058


What is void main ()?

800


which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +

1470


Differentiate call by value and call by reference?

740