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 |
What are Storage Classes in C ?
32 Answers CTS, HP, IBM, Maharaja Whiteline, Tamil Nadu Open University TNOU, TATA, TCS, Wipro,
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
What are the types of arrays in c?
Explain what is the difference between null and nul?
main() { intj; while9j<=10) { printf("\n%d",j); j=j+1; } }
How we add our function in liabrary as liabrary function. Exp. we want use our int factorical(int); function as int pow(int,int); function working in math header file.
Is the exit() function same as the return statement? Explain.
0 Answers Agilent, ZS Associates,
What are global variables and explain how do you declare them?
What are derived data types in c?
int arr[] = {1,2,3,4} int *ptr=arr; *(arr+3) = *++ptr + *ptr++; Final contents of arr[]
why return type of main is not necessary in linux
WAP to accept basic salary of an employee? Calculate it HRA=25%,DA=30%,PF=30%&net salary display all contents?
6 Answers Finite Infotech, Lovely Professional University, Wipro,