Keywords are the words in a language that are used for some internal process or represent some predefined actions. ulong is a keyword that is used to declare a variable which can store an unsigned integer value from the range 0 to 18,446,744,073,709,551,615. It is an alias of System.UInt64.
ulong keyword occupies 8 bytes (64 bits) space in the memory.
Syntax:
ulong variable_name = value;
Example:
Input: num: 223
Output: num: 223
Size of a ulong variable: 8
Input: num = 0
Output: Type of num: System.UInt64
num: 0
Size of a ulong variable: 8
Note:
Example 1:
using System;
using System.Text;
class Prog {
static void Main( string [] args)
{
ulong num = 223;
Console.WriteLine( "num: " + num);
Console.WriteLine( "Size of a ulong variable: " + sizeof ( ulong ));
}
}
|
Output:
num: 223
Size of a ulong variable: 8
Example 2:
using System;
using System.Text;
namespace Test {
class Prog {
static void Main( string [] args)
{
ulong num = 0;
Console.WriteLine( "Type of num: " + num.GetType());
Console.WriteLine( "num: " + num);
Console.WriteLine( "Size of a ulong variable: " + sizeof ( ulong ));
Console.WriteLine( "Min value of ulong: " + ulong .MinValue);
Console.WriteLine( "Max value of ulong: " + ulong .MaxValue);
Console.ReadLine();
}
}
}
|
Output:
Type of num: System.UInt64
num: 0
Size of a ulong variable: 8
Min value of ulong: 0
Max value of ulong: 18446744073709551615
Last Updated :
22 Jun, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...