This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
do I need to report this in the bug list?
- From: Sridhar <asridhar at ishoni dot com>
- To: "'gcc-help at gcc dot gnu dot org'" <gcc-help at gcc dot gnu dot org>
- Date: Tue, 20 Jan 2004 17:09:22 +0530
- Subject: do I need to report this in the bug list?
#include <stdio.h>
int
main(int ac, char **av)
{
unsigned short int a;
unsigned short int b;
printf("Enter a: ");
scanf("%d", &a);
printf("a = %d\n\n", a);
printf("Enter b: ");
scanf("%d", &b);
printf("a = %d\n", a);
printf("b = %d\n", b);
}
Output of the program:
Enter a: 12
a = 12
Enter b: 53
a = 0
b = 53
My problem is that a, becomes zero after the scanf operation of b. And when
I tried to use %h instead of %d the program did even stop for the inputs. I
can avoid the zeroing of if and i declare another short variable between a &
b.
is there any compiler option that I need to enable for compiling this
rightly.
Thanks