为什么这个程序输出错误?
编写内联函数inline int xchg(unsigned char n),计算将unsigned char型n的低四位和高四位交换后的结果。在主函数中输入数据调用函数输出结果。#include<stdio.h>inline int xchg(unsigned char n);
int main()
{
unsigned char n;
int s;
scanf("%c",&n);
s=xchg(n);
printf("%d",s);
return 0;
}
inline int xchg(unsigned char n)
{
int s;
s=(n<<4)|(n>>4);
return s;
}