博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
c# uint 和int_C#中Int64和UInt64之间的区别
阅读量:2527 次
发布时间:2019-05-11

本文共 3309 字,大约阅读时间需要 11 分钟。

c# uint 和int

C#Int64和C#UInt64 (C# Int64 and C# UInt64)

In C#, Int64 known as a signed integer of 8 bytes which can store both types of values including negative and positive between the ranges of -9223372036854775808 to +9223372036854775807.

在C#中, Int64被称为8字节的有符号整数,它可以存储-9223372036854775808到+9223372036854775807范围之间的两种类型的值,包括负数和正

UInt64 known as an unsigned integer of 8 bytes which can store only positive values between the ranges of 0 to 18446744073709551615.

UInt64,它是8个字节的无符号整数 ,只能存储0到18446744073709551615范围之间的正值

“ Int64”和“ UInt64”之间的区别 (Differences between 'Int64' and 'UInt64')

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

Example:

例:

In this example, to explain the differences between Int64 and UInt64 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#中Int64和UInt64之间区别 ,我们将打印它们的最小值和最大值,同时还声明了两个数组– arr1是有符号整数类型,而arr2是无符号整数类型。 根据其容量用相应的负值和正值初始化数组。

using System;using System.Text;namespace Test{
class Program {
static void Main(string[] args) {
//Int64 value range Console.WriteLine("Int64 value capacity..."); Console.WriteLine("Min: {0}, Max: {1}\n", Int64.MinValue, Int64.MaxValue); //UInt64 value range Console.WriteLine("UInt64 value capacity..."); Console.WriteLine("Min: {0}, Max: {1}\n", UInt64.MinValue, UInt64.MaxValue); //Int64 array Int64[] arr1 = {
-9223372036854775808, 0, 1287822320009, 9223372036854700000, 9223372036854775807 }; Console.WriteLine("UInt64 array elements..."); foreach (Int64 num in arr1) {
Console.WriteLine(num); } Console.WriteLine(); //UInt64 array UInt64[] arr2 = {
0, 1239289300, 2399900900022, 18446744073709000000, 1844674407370955161 }; Console.WriteLine("UInt64 array elements..."); foreach (UInt64 num in arr2) {
Console.WriteLine(num); } //hit ENTER to exit Console.ReadLine(); } }}

Output

输出量

Int64 value capacity...Min: -9223372036854775808, Max: 9223372036854775807UInt64 value capacity...Min: 0, Max: 18446744073709551615UInt64 array elements...-92233720368547758080128782232000992233720368547000009223372036854775807UInt64 array elements...012392893002399900900022184467440737090000001844674407370955161

翻译自:

c# uint 和int

转载地址:http://jzozd.baihongyu.com/

你可能感兴趣的文章
JQuery常用函数及功能小结
查看>>
POJ 2653 Pick-up sticks 线段相交
查看>>
PKU JudgeOnline 题目分类
查看>>
网站报错Access denied for user 'root'@'localhost' -问题排查续
查看>>
字符串处理sdut 2411
查看>>
javascript之进阶
查看>>
多个窗体间控件的调用
查看>>
[总结]编程中遇到的vc提示的一些警告
查看>>
Python学习笔记-EXCEL操作
查看>>
9.for循环
查看>>
百度PaddlePaddle再获新技能 智能推荐、对话系统、控制领域都能搞定!
查看>>
SELINUX setsebool
查看>>
C#的Socket程序(TCP/IP)总结
查看>>
java源码生成可运行jar
查看>>
用一个常见的生活小例子来解释和演示面向接口编程
查看>>
找出数组中两个只出现一次的数字
查看>>
【TYVJ水题三连发】1502 兴建高铁 1568 Rabbit Number 1673 位图
查看>>
centos 允许远程连接mysql
查看>>
C#之用XmlWriter保存XML数据
查看>>
光和颜色
查看>>