Re: problem with scanf( )

From: Al Bowers (xabowers_at_rapidsys.com)
Date: 11/28/04


Date: Sat, 27 Nov 2004 21:38:14 -0500


sreelal wrote:
> Dear all,
>
> plz see the following prograam.

There are a few problems.
>

#include <stdio.h>

> main()
int main(void)
>
> {
> int a,b;
>
> scanf("%d %d ",&a,&b);
scanf("%d %d", &a,&b);
will do.
>
> printf("%d %d",a,b);
printf("%d %d\n",a,b);

return 0;
> }
>
>
> when i run the above program on windows using Turbo C,
> the program reads three numbers, ( it is expected to read two numbers only)

Enter the numbers, seperated by a space, ie.
34 23

-- 
Al Bowers
Tampa, Fl USA
mailto: xabowers@myrapidsys.com (remove the x to send email)
http://www.geocities.com/abowers822/


Relevant Pages

  • Re: pointers and array
    ... > How do you use a double pointer to access a two dimensional array. ... int main ... Al Bowers ... mailto: xabowers@myrapidsys.com ...
    (comp.lang.c)
  • Re: problem with scanf( )
    ... and function sscanf to convert to type integers. ... int main ... Al Bowers ... mailto: xabowers@myrapidsys.com ...
    (comp.lang.c)
  • Re: SOURCE CODE FOR DIGITAL CLOCK IN C LANGUAGE
    ... I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE. ... ACTUALLY I WANT TO MAKE A CLOCK IN LINUX>IF ANY BODY POST ME THE ... CODE I HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ ... INT MAIN ...
    (comp.lang.c)
  • Re: SOURCE CODE FOR DIGITAL CLOCK IN C LANGUAGE
    ... I WANT TO MAKE A CLOCK IN LINUX>IF ANY BODY POST ME THE CODE I ... HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ ... INT MAIN ...
    (comp.lang.c)
  • Re: puttextxy( int x, int y, char far *const );
    ... Is thr any way to make puttextxy(int x, int y, char far *const); ... Don't use foolish abbreviations like 'thr', 'plz', etc. Articles ...
    (comp.lang.c)