Using the string Data type in C, this is usually the first option in displaying text in C, by invoking the %s, & Variable in the scanf() input function to read any data in inputs.
But the problem with the string input is that it is not able to show two words when you try to display the data, using gets is far more powerful and able to display two or more words in an input, see the sample program below for the Gets.
#include<stdio.h>
char a[30], b[30];
main( )
{
clrscr();
printf(“Item Name1:”);
gets(a);
printf(“Item Name2:”);
gets(b);
printf(“Items bought”);
printf(“nItem1:%s”,a);
printf(“nItem2:%s”,b);
getch();
return 0;
}
Using Gets in C Sample Program
Mother’s Day Gift Promo Sale 2013 Well Mothers days is just a few days away do you have any surprise gift for your mother? Do you have any gift that will make her special in mothers day? Well if you still don’t have any idea in your mind to make her ...
Secure Shopping Online with Paypal Sign up Don’t let your credit card be exposed, used Paypal to shop online, it is much more secure than by using your credit card, now considered as the holy grail of online payment, accepted by major shopping sites, like Ebay. Shop and receive payments online ...