Difference between revisions of "Data type"

From Free Pascal wiki
Jump to navigationJump to search
m
Line 3: Line 3:
 
A '''data type''' is a classification of a variable or constant.  There are certain data types that are predefined by any Pascal compiler (because you need them to make everything else).  These are:
 
A '''data type''' is a classification of a variable or constant.  There are certain data types that are predefined by any Pascal compiler (because you need them to make everything else).  These are:
  
* [[Byte|byte]] - an unsigned number in the range 0 to 255
+
* [[Byte|byte]] - an unsigned number in the range 0 to 255.
* [[Char|char]] - Single character
+
* [[Char|char]] - Single character.
* [[Integer|integer]] - a whole number. FPC currently uses 4 bytes for integers
+
* [[Integer|integer]] - a whole number. FPC currently uses 4 bytes for integers.
* [[Real|real]] - a number which may have a decimal point and possibly an exponent
+
* [[Real|real]] - a number which may have a decimal point and possibly an exponent.
* [[Cardinal|cardinal]] - an unsigned  whole number,ie it must be positiv
+
* [[Cardinal|cardinal]] - an unsigned  whole number,ie it must be positive.
* [[Set|set]] - a collection of related elements; size depends on number of elements  
+
* [[Set|set]] - a collection of related elements; size depends on number of elements.
* [[Pointer|pointer]] - a reference to a location in memory, generally used for dynamic variables
+
* [[Pointer|pointer]] - a reference to a location in memory, generally used for dynamic variables.
* [[Record|record]] - a combination of the above data types collected together
+
* [[Record|record]] - a combination of the above data types collected together.
 
* [[Class|class]]
 
* [[Class|class]]
* [[Object|object]] - a hybrid entity that may contain data and procedures to manipulate that data
+
* [[Object|object]] - a hybrid entity that may contain data and procedures to manipulate that data.
  
 
Other data types are generally made with some combination of the above.  FPC adds additional data types.
 
Other data types are generally made with some combination of the above.  FPC adds additional data types.

Revision as of 19:45, 25 January 2016

Deutsch (de) English (en) español (es) français (fr) Bahasa Indonesia (id) italiano (it) русский (ru)

A data type is a classification of a variable or constant. There are certain data types that are predefined by any Pascal compiler (because you need them to make everything else). These are:

  • byte - an unsigned number in the range 0 to 255.
  • char - Single character.
  • integer - a whole number. FPC currently uses 4 bytes for integers.
  • real - a number which may have a decimal point and possibly an exponent.
  • cardinal - an unsigned whole number,ie it must be positive.
  • set - a collection of related elements; size depends on number of elements.
  • pointer - a reference to a location in memory, generally used for dynamic variables.
  • record - a combination of the above data types collected together.
  • class
  • object - a hybrid entity that may contain data and procedures to manipulate that data.

Other data types are generally made with some combination of the above. FPC adds additional data types.