write a program to copy a string without using a string?
Answers were Sorted based on User's Feedback
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 |
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 |
How many header files are in c?
What is the difference between void main() and void main (void) give example programme?
Why structure is used in c?
what is difference between getchar,putchar functions and printf and scanf function? does putchar show output only when input given to it
What are the two forms of #include directive?
What is sparse file?
no consistent academics. how to answer the question
What is the use of bitwise operator?
An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode
4) Write a program that takes a 5 digit number and calculates 2 power that number and prints it. i have done maximum par but i m findind problem in the commented area. please help...
how to print value of e(exp1)up to required no of digits after decimal?
How can you invoke another program from within a C program?