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

control 50 devices which has 2 states on and off.using bitwise operator.plz answer it its urgent

1 Answers  


Explain the difference between getch() and getche() in c?

0 Answers  


which of the following go out of the loopo if expn 2 becoming false a.while(expn 1){...if(expn 2)continue;} b.while(!expn 1){if(expn 2)continue;...} c.do{..if(expn 1)continue;..}while(expn 2); d.while(!expn 2){if(expn 1)continue;..}

4 Answers   TCS,


What is volatile keyword in c?

0 Answers  


I have an array of 100 elements, each of which is a random integer. I want to know which of the elements: a) are multiples of 2 b) are multiples of 2 AND 5 c) have a remainder of 3 when divided by 7

1 Answers  


The difference between printf and fprintf is ?

0 Answers   Baan Infotech,


Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

0 Answers   TATA, TCS,


How does normalization of huge pointer works?

0 Answers  


what is ur strangth & weekness

0 Answers   Cognizant, LG Soft, NetEnrich,


What is #include conio h?

0 Answers  


What is the relationship between pointers and data structure?

0 Answers  


What is a scope resolution operator in c?

0 Answers  


Categories