Data Types

Topics: Data type, Data types, Floating point Pages: 7 (1808 words) Published: December 4, 2012
Our interactions (inputs and outputs) of a program are treated in many languages as a stream of bytes. These bytes represent data that can be interpreted as representing values that we understand. Additionally, within a program we process this data that can be interpreted as representing values that we understand. Additionally, within a program we process this data in various way such as adding them up or sorting them. This data comes in different forms. Examples include: your name which is a string of characters; your age which is usually an integer; or the amount of money in your pocket which is usually a value measured in dollars and cents (something with a fractional part). A major part of understand how to design and code programs in centered in understanding the types of data we want to manipulate and how to manipulate that data. A type defines a set of values and a set of operations that can be applied on those values. The set of values for each type is known as the domain for that type. The four major families of data include: •Nothing

The C++ programming language identifies five data types as standard data types: •Void
The standard data types and the complex data types within C++ have a series of attributes, which include: •C++ Reserved or Key Word
Domain – the allowed values
Signage – do they allow negative numbers or only positive numbers •Meaning – i.e What do they represent
Rules of Definition – What special characters indicate the data type •Size – in terms of the number of bytes of storage used in the memory •Operations Allowed – i.e. Which operators can I use on the data type FamilyData TypeReserved WordRepresentsStandard Type

NothingNull or nothingvoidNo dataYes
IntegerBooleanboolLogical true and falseYes
IntegerCharactercharSingle charactersYes
IntegerIntegerintWhole numbersYes
Floating PointFloating PointfloatFractional numbersYes
ComplexStringstringA sequence (sting them along) of charactersNo ComplexArrayn/aA collection of elements of the same typeNo ComplexPointern/aA value that points to location (an address) within the data areaNo

The five standard data types usually exist in most programming languages and act or behave similarly from language to language. The Boolean, character and integer data types are identified as belonging to the Integer Family. These data types are all represented by integer numbers and thus act or behave similarly. Often Used Data Types

1.Integer Data Type
-The integer data type with its various modifiers that create different domains. -The integer family which also includes Boolean and character data types. The integer data type basically represents whole numbers (no fractional parts). The integer values jump from one value to another. It could be asked why not make all your numbers floating point. Which allow for fractional parts. The reason is twofold. First, some things in the real world are not fractional. A dog, even with only 3 legs, is still one (1) dog not ¾ of a dog. Second, integer data type is often used to control program flow by counting, thus the need for a data type that jumps from value to another. The integer data type has the same attributes and acts or behaves similarly in all programming languages. The most often used integer data type in C++ in the simple integer. C++ Reserved Wordint

RepresentWhole numbers (no fractional parts)
SizeUsually 4 bytes
Normal SignageSigned (negative and positive values)
Domain (Values Allowed)-2,147,483,648 to 2,147,483,648
C++ syntax ruleDo not start with a 0 (zero)
C++ syntax ruleNo decimal point

Within C++ there are various reserved words that can be used to modify the size or signage of an integer. They include: long, short, signed and unsigned. Signed is rarely used because integers are signed by default – you must specify...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Data Structure Essay
  • Data Structure Reviewer Essay
  • Data Dictionary Research Paper
  • Object-oriented Programming and Type Essay
  • Data Structure Using C++ Essay
  • Essay on Data Types
  • Data Type and Visual Basic Essay
  • Data Type and Array Essay

Become a StudyMode Member

Sign Up - It's Free