Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to receive strings with spaces in scanf()

Answers were Sorted based on User's Feedback



How to receive strings with spaces in scanf()..

Answer / valli

char a[50];
use scanf(" %[^\n]",a);

Is This Answer Correct ?    10 Yes 2 No

How to receive strings with spaces in scanf()..

Answer / rushabh

scanf("[^\n]s",s);

Is This Answer Correct ?    5 Yes 2 No

How to receive strings with spaces in scanf()..

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

How to receive strings with spaces in scanf()..

Answer / suman halder

#include<stdio.h>
int main()
{
char str[100];
scanf("%[^\n]s",str);

}

Is This Answer Correct ?    2 Yes 1 No

How to receive strings with spaces in scanf()..

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

How to receive strings with spaces in scanf()..

Answer / karthik

using the function
gets(variable)

Is This Answer Correct ?    2 Yes 7 No

How to receive strings with spaces in scanf()..

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

Post New Answer

More C Interview Questions

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?

2 Answers   Excel,


What is a structure in c language. how to initialise a structure in c?

0 Answers  


What are the different types of pointers used in c language?

0 Answers  


what is the difference between %d and %*d in c languaga?

7 Answers   TCS,


What is the use of the sizeof operator?

2 Answers  


Write a program to generate the first n terms in the series --- 2,3,5,7,11,...,17

0 Answers  


What is your favorite subject?

1 Answers   Ericsson, Invendis, Tech Mahindra,


What is the diffences between Windows XP and Windows Visa

1 Answers   Aricent, FHF,


Explain what’s a signal? Explain what do I use signals for?

0 Answers  


what is c

1 Answers  


Do you know what is a programing language ?

0 Answers  


write a program to display numbers from 1 to 10 and 10 to 1?

2 Answers  


Categories