This question already has an answer here:
- Why is 'char' signed by default in C++? 2 answers
- Is char signed or unsigned by default? 7 answers
- Difference between char and signed char in c++? 3 answers
why do I get -87 as output when the input is 1 b I don't seem to understand how is the code working??
#include<stdio.h>
int main()
{
int t,n; char c;
scanf("%d",&t);
while(t--)
{
scanf("%c ",&c);
n=(c-'a');
printf("%d\n",n);
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire