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() { struct date; struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  


Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

0 Answers   Home,


What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;

1 Answers  


Is the following statement a declaration/definition. Find what does it mean? int (*x)[10];

1 Answers  


How do you create a really large matrix (i.e. 3500x3500) in C without having the program crash? I can only reach up to 2500. It must have something to do with lack of memory. Please help!

1 Answers  






how can u draw a rectangle in C

53 Answers   Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,


how to print 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 using any loop(for or while) only once(only 1 loop) and maximum 2 variables using C.

19 Answers   Cap Gemini, Infosys,


main() { { unsigned int bit=256; printf("%d", bit); } { unsigned int bit=512; printf("%d", bit); } } a. 256, 256 b. 512, 512 c. 256, 512 d. Compile error

1 Answers   HCL,


Find the largest number in a binary tree

7 Answers   Infosys,


create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00

0 Answers   Microsoft,


What is wrong with the following code? int *foo() { int *s = malloc(sizeof(int)100); assert(s != NULL); return s; }

1 Answers  


int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }

3 Answers   Cisco, HCL,


Categories