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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

can anyone please tell about the nested interrupts?

1670


When should you use a type cast?

585


Can you mix old-style and new-style function syntax?

658


What is difference between %d and %i in c?

688


What are control structures? What are the different types?

588






What is difference between structure and union with example?

588


What are the different data types in C?

723


What is c language in simple words?

588


What is the difference between strcpy() and memcpy() function in c programming?

622


What does typeof return in c?

633


How many types of operator or there in c?

596


What is the difference between fread and fwrite function?

632


What is the use of c language in real life?

525


Define Array of pointers.

629


a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

680