For this content of the file/stdin:
a 3
W 10
A 100
, 10
k 7
. 3
I 13
I have written the following code
while (k-- > 0)
{
scanf(" %c %d",&c, &p);
printf("c: %d p: %d\n",c,p);
}
if I change the format string in scanf from %c to %d I get the value of c and p as 0. Now the thing is that the character input can be unsigned character so I was wondering how to mention the format string in scanf to take unsigned character. I mean the c can be of type unsigned char. I tried %hh and %u but both gives c the value of 0. Morover, if we have a string consisting of unsigned characters. Then how to take input of it? declaring a string as
unsigned char str[1000]
and passing str to str to fgets gives compile error.