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()

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are control structures? What are the different types?

1141


What is the use of define in c?

1103


Write a program in c to replace any vowel in a string with z?

1170


What are the preprocessor categories?

1114


What is string function c?

1074


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2924


What is the difference between printf and scanf in c?

1428


What is bin sh c?

1097


When should I declare a function?

1213


How do you convert strings to numbers in C?

1296


Why is c platform dependent?

1138


What is hashing in c?

1210


What are the application of void data type in c?

1231


What is file in c preprocessor?

1194


Differentiate between functions getch() and getche().

1108