Tuesday, November 17, 2009

Integer data type


Integer data type

The types of data in the table is specific to the data value rounded numbers. How to declaring the data type is the same as any other declaring, namely:
int a; 

unsigned int b; 
char c; 
long d;

In the C programming language

Integer type used in standard C language is the type int. The size and scope of type int data often depends on the compiler and computer used, but usually equivalent to a short int or long int.

Besides int type, there are several other data types that can hold integers, including:

  • Char. In fact this data type is used to store characters in ASCII code, but can also be used to store an integer from 0 to 255
  • Short int, 2 byte size, range -32.768 to 32.767
  • Long int, size 4 bytes, range -2,147,483,648 to 2,147,483,647
Data types can store on the negative and positive integers. To save a positive number and zero, you can use the keyword unsigned before the type of data. For example:

  • Unsigned short int, 2 byte size, range from 0 to 65.535
  • Unsigned long int, size 4 bytes, range 0 to 4,294,967,295
In the Pascal programming language
In Pascal, integers can accommodate 16-bit Despite its size 2 bytes (16 bits) but because an integer is a signed data type is only capable of in-assign values between -215 to 215-1 of -32,768 to 32767. This is because 1 bit is used as a marker of positive / negative. Despite having the same terms, but an integer data type in Visual Basic.NET programming language and Borland Delphi has size 4 bytes or 32 bits signed so that it can be assign a value between -2,147,483,648 to 2,147,483,647.

In addition to integer type, the Pascal language has several different types:

  • Bytes, the size of 1 byte, range from 0 to 255
  • Smallint, size 1 byte, range from -128 to 127
  • Word, the size of 2 bytes, range from 0 to 65.535
In Pascal compiler newer, also known types of data more like:

  • Longint, size 4 bytes, range from -2,147,483,648 to 2,147,483,647
  • Cardinal, size 4 bytes, range from 0 to 4,294,967,295
In the C # programming language
In the programming language C #, there are several variations of the integer data types, namely:

  • Byte: unmarked integers (unsigned integer) 8-bit. Equivalent System.Byte data type in Microsoft. NET Framework.
  • Sbyte: marked integers (signed integer) 8-bit. Equivalent data type in Microsoft System.Sbyte. NET Framework.
  • Short: integer 16-bit marked. Equivalent to System.Int16 data type in Microsoft. NET Framework.
  • Ushort: unmarked integers (unsigned integer) 16-bit. Equivalent data type in Microsoft System.UInt16. NET Framework.
  • Int: integer marked (signed integer) 32-bit. Equivalent to System.Int32 data type in Microsoft. NET Framework.
  • Uint: unmarked integers (unsigned integer) 32-bit. Equivalent data type in Microsoft System.UInt32. NET Framework.
  • Long: marked integers (signed integer) 64-bit. Equivalent to System.Int64 data type in Microsoft. NET Framework.
  • Ulong: unmarked integers (unsigned integer) 64-bit. Equivalent data type in Microsoft System.UInt64. NET Framework.

No comments:

Post a Comment

 
THANK YOU FOR VISITING