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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • ext.apply()_vba中evaluate使用方法

    ext.apply()_vba中evaluate使用方法EXT.applyEXT.apply方法详解EXT.apply方法详解apply的用法:Ext中apply及applyIf方法的应用apply及applyIf方法都是用于实现把一个对象中的属性应用于另外一个对象中,相当于属性拷贝。不同的是apply将会覆盖目标对象中的属性,而applyIf只拷贝目标对象中没有而源对象中有的属性。apply方法的签名为“apply(Objectobj,Objectconfig,Objectdefaults):Object”,该方法包含

    2022年7月28日
    3
  • sql server 2012 报表开发(2) reporting service 中制作分组折叠式报表

    sql server 2012 报表开发(2) reporting service 中制作分组折叠式报表前面我们学习了sqlserver2012如何使用ReportingService2012制作报表,对ReportingService制作报表,有了初步的了解,这里我主要记录一下,如何做一个分组折叠式的报表.1. 创建一个报表tb_Bills.rdl,添加一个数据集2.在当前报表中,添加一个列表3.在当前列表中,添加一个父组。选择需要分组字段的分组依据,

    2022年10月20日
    0
  • 555施密特触发器电路图_555定时器构成的施密特触发器

    555施密特触发器电路图_555定时器构成的施密特触发器目录方法作用内部电路分析555内部电路图分析仿真电路图仿真结果总结将555的6脚和2脚连接在一起,并在5脚接上0.01uF的电容用于滤波,这就构成了施密特触发器。施密特触发器可作为波形整形电路,能将模拟信号波形整形为数字电路能够处理的方波波形,而且由于施密特触发器具有滞回特性,所以可用于抗干扰,其应用包括在开回路配置中用于抗扰,以及在闭回路正回授/负回授配置中用于实现多谐振荡器。百度百科:https://baike.baidu.com/item/%E6%96%

    2025年7月24日
    0
  • readystate状态码_五种自我状态

    readystate状态码_五种自我状态(0)未初始化此阶段确认XMLHttpRequest对象是否创建,并为调用open()方法进行未初始化作好准备。值为0表示对象已经存在,否则浏览器会报错--对象不存在。(1)载入此阶段对XMLHtt

    2022年8月2日
    8
  • dede标签:定义文件夹

    dede标签:定义文件夹

    2021年9月25日
    41
  • python字典详解_python字典取值

    python字典详解_python字典取值字典字典的key和value一一对应的,字典是可变的,也是有序的(python3.6版本开始字典有序),可迭代的增加元素当key不存在时,直接赋值a={"status"

    2022年7月29日
    12

发表回复

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

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