首页 > 编程语言 > 详细

【C语言】【面试题】【笔试题】对于char 类型用%u与%d输出结果解析

时间:2015-11-01 19:46:16      阅读:501      评论:0      收藏:0      [点我收藏+]
#include <stdio.h>
int main()
{
	char a = 128;//128=127+1=-1;//因为char类型最大能保存的范围为-128~127
	//1000 0000
	//11111111 11111111 11111111 1000 0000
	printf("%u\n", a);
	system("pause");
	return 0;
}

技术分享

#include <stdio.h>
int main()
{
	char a = -1;//128=127+1=-1;
	//1000 0000
	//11111111 11111111 11111111 1000 0000
	printf("%u\n", a);
	system("pause");
	return 0;
}

技术分享

#include <stdio.h>
int main()
{
	char a = -1;
	//1000 0000
	//11111111 11111111 11111111 1000 0000
	printf("%d\n", a);
	system("pause");
	return 0;
}

技术分享

【C语言】【面试题】【笔试题】对于char 类型用%u与%d输出结果解析

原文:http://10740329.blog.51cto.com/10730329/1708383

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!