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

main() { int c=- -2; printf("c=%d",c); }

1 Answers   TCS,


void main() { void *v; int integer=2; int *i=&integer; v=i; printf("%d",(int*)*v); }

1 Answers   Honeywell,


main() { int i=400,j=300; printf("%d..%d"); }

3 Answers  


You are given any character string. Find the number of sets of vowels that come in the order of aeiou in the given string. For eg., let the given string be DIPLOMATIC. The answer returned must be "The number of sets is 2" and "The sets are "IO and AI". Vowels that form a singleton set must be neglected. Try to post the program executable in gcc or g++ or in java.

3 Answers  


main() { int i=10; void pascal f(int,int,int); f(i++,i++,i++); printf(" %d",i); } void pascal f(integer :i,integer:j,integer :k) { write(i,j,k); }

1 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  


code of a program in c language that ask a number and print its decremented and incremented number.. sample output: input number : 3 321123

1 Answers   HCL,


void main () { int x = 10; printf ("x = %d, y = %d", x,--x++); } a. 10, 10 b. 10, 9 c. 10, 11 d. none of the above

2 Answers   HCL,


write a c program to Reverse a given string using string function and also without string function

1 Answers  


Design an implement of the inputs functions for event mode

0 Answers   Wipro,


What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql

0 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,


Categories