unsigned int在c语言中是什么意思_尿液报告里面vc什么意思

unsigned int在c语言中是什么意思_尿液报告里面vc什么意思在一个项目中,要求用VC6写DLL,其中有字段要求用UINT16,vc6中没有UINT16。UINT16,无符号int要16位,占2字节(1字节byte=8位bit),1111111111111111,表示范围0~65535。在此,我想到用别的类型代替它,并对范围测试,下面用vc6随便建一个程序,添加一个button双击添加代码:000000000000000


Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

在一个项目中,要求用VC6写DLL,其中有字段要求用UINT 16,vc6中没有UINT16。

UINT16,无符号int要16位,占2字节(1字节byte=8位bit),1111 1111 1111 1111,表示范围0~65535。

unsigned int在c语言中是什么意思_尿液报告里面vc什么意思

在此,我想到用别的类型代替它,并对范围测试,

下面用vc6随便建一个程序,添加一个button双击添加代码:

0000 0000 0000 0000 ~ 1111 1111 1111 1111

short:默认带符号的,最高位1为符号位,表示范围 : -32768~32767

unsigned short:为不带符号的,表示范围:  0~65535

signed short :为带符号的,表示范围: -32768~32767

__int16,

__int32,这俩不知道是啥,不研究了,只是在vc6中无意看到有这种类型,等以后有空再研究。

<span style="white-space:pre">	</span>short a=1;
	unsigned short b=1;
	signed short c=1;
	__int16 d;
	__int32 e;

	CString strSho;
	int i;
	while(1)
	{
	if (a>0)
	{
		a++;
	}
	else
	{
		a= a-1;
		//strSho.Format("a = %d",a);
		//AfxMessageBox(strSho);
		break;
	}
	}

	while(1)
	{
		if (b>0)
		{
			b++;
		}
		else
		{
			b = b - 1;
			break;
		}
	}

	while(1)
	{
		if (c>0)
		{
			c++;
		}
		else
		{
			c = c - 1;
			break;
		}
	}

	while(1)
	{
		if (d>0)
		{
			d++;
		}
		else
		{
			d = d - 1;
			break;
		}
	}

	while(1)
	{
		if (e > 0)
		{
			e++;
		}
		else
		{
			e = e - 1;
			break;
		}
	}

	strSho.Format("MAX a = %d,MAX b = %d, MAX c = %d, MAX d = %d, MAX e = %d",a,b,c,d,e);
	AfxMessageBox(strSho);

结果:

a=32767;

b=65535;

c=32767;

d=-13109;//这个不认识,算了,扔了吧

e=-858983461;//这个也不认识



补充:

刚刚看了下,__int16,__int32的介绍,下面是msdn的说法:

https://msdn.microsoft.com/en-us/library/29dh1w7z.aspx

Microsoft C/C++ features support for sized integer types. You can declare 8-, 16-, 32-, or 64-bit integer variables by using the __intn type specifier, where n is 8, 16, 32, or 64. 

The following example declares one variable for each of these types of sized integers:

Copy 
__int8 nSmall;      // Declares 8-bit integer
__int16 nMedium;    // Declares 16-bit integer
__int32 nLarge;     // Declares 32-bit integer
__int64 nHuge;      // Declares 64-bit integer
The types __int8, __int16, and __int32 are synonyms for the ANSI types that have the same size, and are useful for writing portable code that behaves identically across multiple platforms. The __int8 data type is synonymous with type char, __int16 is synonymous with type short, and __int32 is synonymous with type int. The __int64 type has no ANSI equivalent.

Example
The following sample shows that an __intxx parameter will be promoted to int:

Copy 
// sized_int_types.cpp

#include <stdio.h>

void func(int i) {

    printf_s(“%s\n”, __FUNCTION__);
}

int main()
{

    __int8 i8 = 100;
    func(i8);   // no void func(__int8 i8) function
                // __int8 will be promoted to int
}
func

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/170549.html原文链接:https://javaforall.net

赞 (0)
全栈程序员-站长的头像全栈程序员-站长

相关推荐

  • ORA-00988: missing or invalid password(s)

    ORA-00988: missing or invalid password(s)创建账号或修改账号密码时有可能会遇到ORA-00988:missingorinvalidpassword(s),那么什么情况下会遇到这种错误呢?一般是因为密码的设置不符合命名规范:1:密码

    2022年7月1日
  • CSSS选择器总结[通俗易懂]

    CSSS选择器总结[通俗易懂]title:CSSS选择器总结date:2018073020:11:07tags:css在css的学习中有一个很容易让人混乱的就是css选择器,因为选择器有很多种,而且在使用的时候有

    2022年8月6日
  • vue父子组件传值props_vue子组件调用父组件的方法并传参

    vue父子组件传值props_vue子组件调用父组件的方法并传参vue页面结构在做项目的时候常常有这样的一个情况,这个页面的数据(比如:id号)要带到另一个页面去查询某个数据的详情等,传统的做法不是在url上加参数,cookie或者是现在H5的“sessionStorage”和“localStorage”上赋值,这是页面之间传递的方法。随着Angularjs,React,Vue的流行组件式的开发方式成为另一种不错的解决方案。最近就有一些小伙伴问我,vue组件之间是如何传递参数的?其实vue是有三种方式可以组件之间传递数据(props,组件通信,slot)..

    2022年10月30日
  • ubuntu重装apt_怎么设置apt get的源

    ubuntu重装apt_怎么设置apt get的源在linux上开发时,更换apt源是很常规的操作,如果对源的理解不透彻,更换不成功后都不知道是什么原因,就是换着瞎碰,因此决定对换源的操作进行研究

    2022年10月14日
  • pytorch MSELoss参数详解「建议收藏」

    pytorch MSELoss参数详解「建议收藏」pytorchMSELoss参数详解importtorchimportnumpyasnploss_fn=torch.nn.MSELoss(reduce=False,size_average=False)a=np.array([[1,2],[3,8]])b=np.array([[5,4],[6,2]])input=torch.autograd.Variable(to…

    2022年9月18日
  • 无效的token怎么解决_登录token

    无效的token怎么解决_登录token解决无效token的方法在调用API接口时遇到了无效token的问题,网上搜了一大圈还以为是token时效的问题,最后发现是给需要授权的API,必须在请求头中使用Authorization字段提供token令牌。需要在main.js文件里添加axios拦截器axios.interceptors.request.use(config=>{console.log(config);config.headers.Authorization=window.sessionSt

    2022年9月13日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号