一些不匹配的整型转换
// 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放在尾端打可以正常打印的原因是什么? 看不明白你在说什么不同... 把你的输入输出列出来
页:
[1]