|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
// intconv.c -- 一些不匹配的整型转换
#include <stdio.h>
#define PAGES 336
#define WORDS 65618
int main(void)
{
char ch;
const short num = PAGES;
const short mnum = -PAGES;
//scanf("%d",&ch);
printf("%d %c\n",ch,ch);
printf("num as short and unsigned short: %hd %hu\n", num, num);
printf("-num as short and unsigned short: %hd %hu\n",mnum, mnum);
printf("num as int and char: %d %c:\n", num, num);
printf("WORDS as int, short, and char: %d %hd %c\n", WORDS, WORDS, WORDS);
//scanf("%d",&ch);
//printf("%d %c\n",ch,ch);
return 0;
}
求助大佬!
scanf截断输入字符值后,打印字符第1、2、3、列打印输出结果不同的原因是什么?
第一段scanf截断造成输出结果不同,scanf放在尾端打可以正常打印的原因是什么? |
|