Data Types-Doug's work

Data Types

A data type is a data storage format that can contain a specific type or range of values.

Boolean: a Boolean data type is a value that is either true or false. By default the Boolean data type is set to false. A Boolean operator or logical operator consists of operators such as AND, OR, NOT, NOR, NAND and XOR, and are used with conditional statements. The Boolean data type is the smallest data type as its memory size is 1bit.



Integer: an integer is a whole number that can be a positive, negative or zero. Unlike floating point numbers, integers cannot have decimal places. Integers are a commonly used data type in computer programming. When a number is being used, such as within a four loop or while loop an integer is used. An integers memory size is 2 bytes but can sometimes be 4 bytes.



String: most programming languages have a data type called a data string which is used for data values that are made up of ordered sequences of characters. A string can contain any sequence of characters visible or invisible and characters may be repeated. The number of characters in the string is called its length, however there is usually a restriction on the maximum length of the string. There is also something called an empty string which contains a 0 length as there are no characters.



Real: a real data type number is numerical data which contains decimal number. It would be used when extra detail is required and a whole number would not provide enough information. A real data type cannot store the measurement symbol itself, nor the type of quantity being measured. If you use this data type then you need to put the unit of measurement after the field name. For small amounts currency the decimal places would probably be used so you would probably use the real data type. A real data types memory size is 4 bytes.



Character: character data type stores strings of letters, numbers and symbols. Character data can be stored as fixed length or variable length strings. Fixed length strings are right extended with spaces on output, variable length strings are not extended. The data types character can be referred to as character string types, and the values of character string types are known as character strings. Character data type memory size is 2 bytes.






Comments