correct way to use getchar function?

  • From: ashish rohtagi <ashishrohtagi1969@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Fri, 15 Apr 2011 09:23:33 +0530

hello friends, I tried to use getchar in this program, please show my
mistakes, as it is not working correctly. here is the code. #include
<stdio.h>

int main() {
char name[20]; char color[20];

printf("What is your name?"); scanf("%s",name);
printf("What is your favorite color?"); scanf("%s",color);
printf("%s's favorite color is %s\n",name,color);

                         getchar();

              return(0);
}
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: