c语言uint16什么意思_int16的取值范围

c语言uint16什么意思_int16的取值范围uint16intc#C#Int16和C#UInt16(C#Int16andC#UInt16)InC#,Int16knownasasignedintegerof2byteswhichcanstorebothtypesofvaluesincludingnegativeandpositivebetweentherangesof-32…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

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

uint16 int c#

C#Int16和C#UInt16 (C# Int16 and C# UInt16)

In C#, Int16 known as a signed integer of 2 bytes which can store both types of values including negative and positive between the ranges of -32768 to +32767.

在C#中, Int16被称为2字节的有符号整数,它可以存储-32768至+32767范围之间的两种类型的值,包括负数和正数。

UInt16 known as an unsigned integer of 2 bytes which can store only positive values between the ranges of 0 to 65535.

UInt16,它是2个字节的无符号整数 ,只能存储0到65535范围之间的正值。

‘Int16’和’UInt16’之间的区别 (Differences between ‘Int16’ and ‘UInt16’)

Int16 UInt16
Int16 stands for signed integer. UInt16 stands for unsigned integer.
It’s capacity to store the value is -32768 to +32767. It’s capacity to store the value is 0 to 65535.
It can store negative and positive integers. It can store only positive integers.
It occupies 2-bytes space in the memory. It also occupies 2-bytes space in the memory.
Declaration syntax:
Int16 variable;
Declaration syntax:
UInt16 variable;
16位 UInt16
Int16代表有符号整数。 UInt16代表无符号整数。
它存储值的能力是-32768至+32767。 该值的存储容量为0到65535。
它可以存储负整数和正整数。 它只能存储正整数。
它在内存中占用2个字节的空间。 它还在内存中占用2字节的空间。
声明语法:
Int16变量;
声明语法:
UInt16变量;

Example:

例:

In this example, to explain the differences between Int16 and UInt16 in C#, we are printing their minimum and maximum values, we are also declaring two arrays – arr1 is a signed integer type and arr2 is an unsigned integer type. Initializing the arrays with corresponding negative and positive values based on their capacity.

在此示例中,为了解释C#中Int16和UInt16之间区别 ,我们将打印它们的最小值和最大值,同时还声明了两个数组– arr1是有符号整数类型,而arr2是无符号整数类型。 根据其容量用相应的负值和正值初始化数组。

using System;
using System.Text;

namespace Test
{
   
   
    class Program
    {
   
   
        static void Main(string[] args)
        {
   
   
            //Int16 value range 
            Console.WriteLine("Int16 value capacity...");
            Console.WriteLine("Min: {0}, Max: {1}\n", Int16.MinValue, Int16.MaxValue);

            //UInt16 value range 
            Console.WriteLine("UInt16 value capacity...");
            Console.WriteLine("Min: {0}, Max: {1}\n", UInt16.MinValue, UInt16.MaxValue);

            //Int16 array
            Int16[] arr1 = {
   
    -32768, 0, 1000, 32000, 32767};
            Console.WriteLine("UInt16 array elements...");
            foreach (Int16 num in arr1)
            {
   
   
                Console.WriteLine(num);
            }
            Console.WriteLine();

            //UInt16 array
            UInt16[] arr2 = {
   
    0, 100, 23000, 65000, 65525};
            Console.WriteLine("UInt16 array elements...");
            foreach (UInt16 num in arr2)
            {
   
   
                Console.WriteLine(num);
            }

            //hit ENTER to exit
            Console.ReadLine();
        }
    }
}

Output

输出量

Int16 value capacity...
Min: -32768, Max: 32767

UInt16 value capacity...
Min: 0, Max: 65535

UInt16 array elements...
-32768
0
1000
32000
32767

UInt16 array elements...
0
100
23000
65000
65525


翻译自: https://www.includehelp.com/dot-net/Int16-and-UInt16-in-c-sharp.aspx

uint16 int c#

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

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

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


相关推荐

  • 代码空间项目 — InstantiationException的异常

    代码空间项目 — InstantiationException的异常java.lang.InstantiationException实例化异常。当试图通过newInstance()方法创建某个类的实例,而该类是一个抽象类或接口时,抛出该异常。这次项目中查询type时候

    2022年7月1日
    25
  • Lena图像分解成小块与从小块合成

    Lena图像分解成小块与从小块合成 ➤01背景在2020年人工神经网络课程第一次作业第八题中需要对Lena图像使用AutoEncode网络进行压缩。将Lena(灰度图像)拆解成不同尺寸的大小形成训练压缩样本过程;或者从训练结果重新组合成Lena灰度图像是实验的基础。▲Lena灰度图像下面给出相关操作的Python程序和相关的结果。主要操作包括:将512×512的Lena灰度图片(0~255)分割成边长8~16的图像块,并通过行扫描形行向量;对图像进行归一化,形成数据在-0.5~0.5之

    2022年6月19日
    25
  • Thinkphp 加载更多

    Thinkphp 加载更多

    2021年10月30日
    58
  • 最短路径算法汇总「建议收藏」

    最短路径算法汇总「建议收藏」1、Floyd-Warshall算法A、算法基本思想   在有向连通图中,从任意顶点i到顶点j的最短路径,可以看做从顶点i出发,经过m个顶点中转,到达j的最短路程。最开始可以只允许经过”1”号顶点进行中转,接下来只允许经过”1”号顶点和”2”号顶点进行中转……允许经过”1”~”m”号顶点进行中转,求任意两顶点的最短路程。B、算法实现for(intk=1;k<=n;

    2022年5月31日
    87
  • FIONREAD 判断 socket有多少数据可读[通俗易懂]

    FIONREAD 判断 socket有多少数据可读[通俗易懂]Ioctl(sockfd,FIONREAD,&npend); /*checkFIONREADsupport*/检查sockfd表示的文件描述符中有多少数据可以读取

    2022年7月23日
    17
  • lua编写游戏脚本教程_ps2游戏转ps4pkg

    lua编写游戏脚本教程_ps2游戏转ps4pkg先扫盲WQSG是干什么用的一些掌机类游戏汉化比方PSPNDS汉化必备之物它能够依据字典转换文本假设你不知道这是啥玩意,快去充电染成茜色的坂道文本提取(导出)方法(下文称导出文章)在导出文章,我

    2022年8月4日
    15

发表回复

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

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