C statement to copy a string without using loop and library
function..

Answers were Sorted based on User's Feedback



C statement to copy a string without using loop and library function....

Answer / abhishek soni

main(){
char ch[10]="Welcome";
char copy[10];
int i=0;
clrscr();
copyStr:
copy[i] = ch[i++];
if(ch[i] != '\0')
goto copyStr;
printf("%s",copy);
getch();
}

Is This Answer Correct ?    72 Yes 8 No

C statement to copy a string without using loop and library function....

Answer / goresh

main()
{
char str1[]="My name is Goresh...";
char *p;
p=str1;
printf("%s",p);
}

Is This Answer Correct ?    28 Yes 13 No

Post New Answer

More C Code Interview Questions

void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }

3 Answers  


char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)

1 Answers  


main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?

2 Answers  


void main() { static int i=i++, j=j++, k=k++; printf(ā€œi = %d j = %d k = %dā€, i, j, k); }

3 Answers  


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

3 Answers  






main(int argc, char *argv[]) { (main && argc) ? main(argc-1, NULL) : return 0; } a. Runtime error. b. Compile error. Illegal syntax c. Gets into Infinite loop d. None of the above

4 Answers   HCL, LG,


main() { extern int i; i=20; printf("%d",sizeof(i)); }

2 Answers  


main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }

1 Answers  


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  


void main() { int i=i++,j=j++,k=k++; printf(ā€œ%d%d%dā€,i,j,k); }

1 Answers  


Cluster head selection in Wireless Sensor Network using C programming language.

0 Answers  


/*what is the output for*/ void main() { int r; printf("Naveen"); r=printf(); getch(); }

4 Answers  


Categories