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 type modifiers in c?

997


int i=10; printf("%d %d %d", i, i=20, i);

1546


What is the size of array float a(10)?

1087


Write a code to generate a series where the next element is the sum of last k terms.

1166


What is the use of clrscr?

1045


Is null always equal to 0(zero)?

988


What is the difference between a free-standing and a hosted environment?

1094


Define recursion in c.

1196


What is volatile c?

952


Are comments included during the compilation stage and placed in the EXE file as well?

1026


How can you access memory located at a certain address?

1057


Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?

2494


What is the need of structure in c?

1044


Write the control statements in C language

1124


Is there anything like an ifdef for typedefs?

1084