String copy logic in one line.

Answers were Sorted based on User's Feedback



String copy logic in one line...

Answer / yash

while ((*target++ = *source++));

Is This Answer Correct ?    41 Yes 9 No

String copy logic in one line...

Answer / lavanya

for(i=0;(str2[i]=str1[i])!='\0';i++);

Is This Answer Correct ?    20 Yes 5 No

String copy logic in one line...

Answer / raghuram.a

while(str1[i]!=0) str2[j++]=str1[i++];

Is This Answer Correct ?    17 Yes 14 No

String copy logic in one line...

Answer / marrthand

for(i=0;i<=strlen(s1[i];i++){s1[i]=s2[i];}

Is This Answer Correct ?    2 Yes 0 No

String copy logic in one line...

Answer / gowrishankaran

while(str1[i]!=0) str2[j++]=str1[i++];

Is This Answer Correct ?    2 Yes 1 No

String copy logic in one line...

Answer / shruthirap

for(i=0; str2[i] = str1[i]; i++);

Is This Answer Correct ?    9 Yes 9 No

String copy logic in one line...

Answer / jitendra

void cpy_user(char *s, char *t)
{
while ((*s++ = *t++) != '\0');
}

Is This Answer Correct ?    7 Yes 7 No

String copy logic in one line...

Answer / anurag

SORRY !!!
The last posted Ans. is for reverse of the string in one
line...by mistake it has been posted in this.

Is This Answer Correct ?    4 Yes 5 No

String copy logic in one line...

Answer / anurag

int i=0,len=strlen(str);
int j=len/2;len--;
while(i<j)
{
*(str+i)^=*(str+len)^=*(str+i)^=*(str+len);
len--;i++;
}

Is This Answer Correct ?    4 Yes 7 No

String copy logic in one line...

Answer / vijay

strpy(n1,n2)
here copy of string n2 in string n1

Is This Answer Correct ?    12 Yes 24 No

Post New Answer

More C Code Interview Questions

main() { int i=5; printf("%d",++i++); }

1 Answers  


Write a c program to search an element in an array using recursion

1 Answers   Wipro,


Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };

1 Answers  


write a c program to Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 5 users and display the details. In place of password display “****”. (Use Structures).

0 Answers   CDAC, College School Exams Tests,


main() { char a[4]="HELL"; printf("%s",a); }

3 Answers   Wipro,






main() { unsigned char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

1 Answers  


write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details

2 Answers   TCS,


what is the code of the output of print the 10 fibonacci number series

2 Answers  


Derive expression for converting RGB color parameters to HSV values

1 Answers  


typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); }

1 Answers  


There is a lucky draw held every day. if there is a winning number eg 1876,then all possible numbers like 1867,1687,1768 etc are the numbers that match irrespective of the position of the digit. Thus all these numbers qualify fr the lucky draw prize Assume there is no zero digit in any numbers. write a program to show all the possible winning numbers if a "winning number"is passed as an arguments to the function.

1 Answers   Nagarro,


pls anyone can help me to write a code to print the values in words for any value.Example:1034 to print as "one thousand and thirty four only"

2 Answers  


Categories