码迷,mamicode.com
首页 > 编程语言 > 详细

C语言 宏判断有符号无符号 整型变量

时间:2014-10-04 14:07:06      阅读:273      评论:0      收藏:0      [点我收藏+]

标签:blog   sp   div   c   log   amp   r   ef   bs   

#define ISUNSIGNED(x) ((x)>=0&&~(x)>=0)
#define ISSINGNED(x)   ((x)>=0?((~(x))<0?true:false):true)

  有符号与无符号的区别:最高位是否为1  ,有符号最高位为1表示负数.

C语言 宏判断有符号无符号 整型变量

标签:blog   sp   div   c   log   amp   r   ef   bs   

原文地址:http://www.cnblogs.com/start2014/p/4005760.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!