字符转ASCII码_牛客题霸_牛客网 (nowcoder.com)
#include<stdio.h>
int main()
{
int a;
scanf("%c",&a);
printf("%hhd",a);//%hhd对应char,%hd对应short,%d对应int,%ld对应long,%lld对应long long
return 0;
}
总结:
%hhd对应char,
%hd对应short,
%d对应int,
%ld对应long,
%lld对应long long