Hurd: Fix value of __libc_stack_end
[glibc.git] / stdio-common / scanf3.c
blob33495cca79f84f0361b8c10d6a9ea72b3996019b
1 #include <stdio.h>
2 #include <stdlib.h>
4 int
5 main(int arc, char *argv[])
7 int n, res;
8 unsigned int val;
9 char s[] = "111";
11 val = n = -1;
12 res = sscanf(s, "%u %n", &val, &n);
13 printf("Result of sscanf = %d\n", res);
14 printf("Scanned format %%u = %u\n", val);
15 printf("Possibly scanned format %%n = %d\n", n);
16 if (n != 3 || val != 111 || res != 1)
17 abort ();
19 val = n = -1;
20 res = sscanf(s, "%u%n", &val, &n);
21 printf("Result of sscanf = %d\n", res);
22 printf("Scanned format %%u = %u\n", val);
23 printf("Possibly scanned format %%n = %d\n", n);
24 if (n != 3 || val != 111 || res != 1)
25 abort ();
27 return 0;