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
while initialization of array why we use a[][2] why not a[2][]...?
What is oops c?
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
There seem to be a few missing operators ..
What type is sizeof?
What is pointer in c?
How to find a missed value, if you want to store 100 values in a 99 sized array?
What are data types in c language?
Write a program to reverse a given number in c language?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above
What is pointer and structure in c?
What is a node in c?
What is the meaning of 2d in c?
What is use of pointer?