answersLogoWhite

0


Best Answer

Binary data is intrinsically numeric, therefore every type (including user-defined types) can be represented as a number. Even an executable or a file is nothing more than an extremely large number, in binary, made up of a specific sequence of bits grouped in various ways (bytes, words, dwords, etc), each of which is a number in its own right.

What these numbers actually represent is purely a matter of interpretation. While a char type is typically used to represent an alphanumeric character or symbol, it is really just a character code (a number in the range 0 to 255) that can be mapped to a symbolic character in the ASCII character set. A char is therefore no different to a byte and can represent an actual number just as easily as it can a character.

The primitive types are: unsigned short int, short int, unsigned long int, long int, int, unsigned int, char, wchar_t, bool, float, double and long double, each of which is intrinsically numeric. All user-defined types, including classes and structures, are derived from some combination of these primitive types.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

7y ago

C++ has a set of fundamental types corresponding to the most common basic storage units of a computer and the most common ways of using them to hold data.

  • A Boolean type (bool).
  • Character types (such as char and wchar_t).
  • Integer types (such as int and long long).
  • Floating-point types (such as float and long double).
  • A type, void, used to signify the absence of information.

From these types, we can construct other types using declarator operators:

  • Pointer types (such as int*).
  • Array types (such as char[]).
  • Reference types (such as double& and vector&&).


In addition, a user can define additional types:

  • Data structures and classes (union, struct and class).
  • Enumeration types for representing specific sets of values (enum and enum class).


The Boolean, character and integer types are collectively called integral types. The integral and floating-point types are collectively called arithmetic types. Enumerations and classes are called user-defined types because they must be defined by users rather than being available for use without previous declaration, the way fundamental types are. In contrast, fundamental types, pointers and references are collectively referred to as built-in types. The standard library provides many user-defined types.

The Integral and floating-point types are provided in a variety of sizes to give the programmer a choice of the amount of storage consumed, the precision, and the range available for computations. The assumption is that a computer provides bytes for holding characters, words for holding and computing integer values, some entity most suitable for floating-point computations, and addresses for referring to those entities. The C++ fundamental types together with pointers and arrays present these machine-level notions to the programmer in a reasonably implementation-independent manner.

For most applications, we could use bool for logical values, char for characters, int for integer values and double for floating-point values. The remaining fundamental types are variations for optimisations, special needs and compatibility that are best ignored until such needs arise.

Source: The C++ Programming Language, Fourth Edition (Bjarne Stroustrup).
This answer is:
User Avatar

User Avatar

Wiki User

12y ago

All the standard primitives and structures, plus objects and user-defined data types can be used in C++. The only limit is your imagination.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the data types use in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

When do we use int in c plus plus programming?

'int' is one of the built-in data-types, it is meant to hold integer values.


Why c plus plus called as paritial oop?

C++ is only partially OOP because it is a superset of C and, for the sake of backward compatibility, retains the concept of primitive data types (such as integrals like char and int) and pointer data types, which are all strictly non-object-oriented. In Java and C#, there is no concept of a primitive data type. Even integral types such as int are treated as objects and there is no concept of a pointer data type.


How do you use or integrate c plus plus code in visual basic 6?

You can't integrate C++ source code directly into Visual Basic code. In order to make use of code written in another language, including C++, you must compile that source to produce a DLL. You can then link to that DLL via Visual Basic. The only caveat is that you must replace the C++ data types in the function declarations with the equivalent Visual Basic data types, such as 'Byte' for a C++ unsigned char, or 'Single' for a C++ float.


Describe the four basic data types in c?

Describe the basic data types in C Describe the basic data types in C


What types of data used in algorithm?

Whatever data you need. If you need the algorithm to operate with many different types of data, and you are programming in C++, you could use generic programming practices and use templates.

Related questions

When do we use int in c plus plus programming?

'int' is one of the built-in data-types, it is meant to hold integer values.


What are the two types of constant in c plus plus?

Constant data and constant functions.


User defined data type in c plus plus?

Use "typedef" : both in C and C++.


Memory allocation in c plus plus?

Although C++ inherits malloc/calloc, realloc and free from C, programmers are encouraged to use the object-oriented operators, new and delete instead. Not only are they much easier to use, they can also be used with primitive data types.


What use of void data type in c plus plus?

doesn't return the value.


Why c plus plus called as paritial oop?

C++ is only partially OOP because it is a superset of C and, for the sake of backward compatibility, retains the concept of primitive data types (such as integrals like char and int) and pointer data types, which are all strictly non-object-oriented. In Java and C#, there is no concept of a primitive data type. Even integral types such as int are treated as objects and there is no concept of a pointer data type.


How do you use or integrate c plus plus code in visual basic 6?

You can't integrate C++ source code directly into Visual Basic code. In order to make use of code written in another language, including C++, you must compile that source to produce a DLL. You can then link to that DLL via Visual Basic. The only caveat is that you must replace the C++ data types in the function declarations with the equivalent Visual Basic data types, such as 'Byte' for a C++ unsigned char, or 'Single' for a C++ float.


What is the difference between class data type and basic type in c plus plus .How can someone know which one is class type and which one is basic type.?

Basic types (primitive data types) have no methods associated with them.


Describe the four basic data types in c?

Describe the basic data types in C Describe the basic data types in C


What is object oriented in c plus plus?

Object-oriented programming is a feature in C++ that allows you to better model real-world objects. An object is an instance of a class, which is a data structure in C++ that allows you to group different, but related types of data together.


What types of data used in algorithm?

Whatever data you need. If you need the algorithm to operate with many different types of data, and you are programming in C++, you could use generic programming practices and use templates.


When you use decimal which type of data is it?

Decimal numbers are real numbers. In C and C++ we use the float, double and long double data types to represent real numbers.