How to receive strings with spaces in scanf()
Answers were Sorted based on User's Feedback
Answer / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
char a[50];
printf("enter the string :");
for(int i=0;1;i++)
{
scanf("%c",&a[i]);
if(a[i]=='\n')
a[i]='\0'
break;
}
for(i=0;a[i]!='\0;i++)
printf("%c",a[i]);
getch();
}
| Is This Answer Correct ? | 4 Yes | 3 No |
Answer / suman halder
#include<stdio.h>
int main()
{
char str[100];
scanf("%[^\n]s",str);
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / murugannr
#include<studio.>
#include<coino.>
viod main
{
int a,b:
char a[12];
char b[10];
Printf{"enter the using string a,b");
scanf("%s,%a,%b");
get(ab)
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / parmjeet kumar
#include<stdio.h>
#include<conio.h>
void main()
{
char a[50];
printf("enter the string:");
scanf("%s",&a);
printf("%s",a);
getch();
}
| Is This Answer Correct ? | 0 Yes | 10 No |
Why data types in all programming languages have some range? Why ritche have disigned first time likethat?Why not a single data type can support all other types?
What is a structure in c language. how to initialise a structure in c?
What are the different types of pointers used in c language?
what is the difference between %d and %*d in c languaga?
What is the use of the sizeof operator?
Write a program to generate the first n terms in the series --- 2,3,5,7,11,...,17
What is your favorite subject?
1 Answers Ericsson, Invendis, Tech Mahindra,
What is the diffences between Windows XP and Windows Visa
Explain what’s a signal? Explain what do I use signals for?
what is c
Do you know what is a programing language ?
write a program to display numbers from 1 to 10 and 10 to 1?