write a program to copy a string without using a string?

Answers were Sorted based on User's Feedback



write a program to copy a string without using a string?..

Answer / balaji ganesh

#include<stdio.h>
#include<string.h>
void main()
{
char a[50],b[50];
int i,n=0;
clrscr();
printf("enter a string:");
while((a[n]=getchar())!='\n')
{
b[n]=a[n++];
}
for(i=0;i<n;i++)
printf("%c",b[i]);
getch();
}

Is This Answer Correct ?    5 Yes 2 No

write a program to copy a string without using a string?..

Answer / j j ramesh

void main()
{
char str1[100],str2[100];
printf("ENTER THE STRING :");
gets(str1);
for(i=0;str1[i];i++)
str2[i] = str1[i]l
pritf("COPIED : %s",str2);
}

Is This Answer Correct ?    4 Yes 1 No

Post New Answer

More C Interview Questions

How to Throw some light on the splay trees?

0 Answers  


how to find out the union of two character arrays?

2 Answers  


Is it possible to create recycle bin in mobiles?

2 Answers  


Explain the priority queues?

0 Answers  


When was c language developed?

0 Answers  


How do I copy files?

0 Answers  


How will you allocate memory to double a pointer?

1 Answers  


How do you sort filenames in a directory?

0 Answers  


What are the different types of endless loops?

0 Answers  


main() { printf("\n %d %d %d",sizeof('3'),sizeof("3"),sizeof(3)); } wat is the o/p and how?

12 Answers   Tech Mahindra,


What is the function of this pointer?

0 Answers   Agilent, ZS Associates,


What is c basic?

0 Answers  


Categories