answersLogoWhite

0


Best Answer

The built-in (fundamental) data types are int, char, bool, float, double and pointer. All other integral types are either modified types or aliases (typedefs). User-defined types (including those provided by the standard library) are not considered part of the language.

User Avatar

Wiki User

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

Wiki User

10y ago

Declare the type (int, char, double, etc) followed by the name of the variable. The variable name is a reference to the memory allocated to the type being declared. If the variable is a pointer to the type, precede the name with *. In C++, you may also initialise variables in the declaration.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

C++ is a strongly-typed language. This means that every variable must have a type associated with it. The type determines how many bytes are allocated to the variable, and how those bytes are to be interpreted. So an unsigned char variable is always one byte in length and is interpreted as being an unsigned value in the range 0 to 255 (which can be interpreted as an ASCII character code). A pointer is always 32-bits long on a 32-bit system (or 64 bits on a 64-bit system) since it is used to store a 32-bit memory address. The data type associated with the pointer refers to how the stored memory address is to be treated. Thus a pointer to a char allows the memory address to be treated as if the value at that address were really a char, regardless of its actual type. Pointers can also be typed with void*, meaning the memory address will have an unknown type (effectively any type). However, the pointer must be cast to an actual type at runtime using RTTI (runtime type information) in order to access the contents of that memory appropriately.

The strong typing exists both to protect the programmer from accessing memory in an obviously inappropriate manner (the compiler will warn you when you attempt to make any inappropriate accesses), but also to provide efficient storage and high-performance retrieval of variables and their values. Weakly-typed languages offer a higher degree of flexibility, often using variant types, but are less efficient as a result. However, strong-typing does not mean strict typing; C++ is flexible enough to allow data types to be cast from one to another just as if they were variant types. If a specific cast does not exist, you can easily implement one to meet your needs.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

C++ is a strongly-typed language, thus every variable, constant and function must have an explicit type declaration.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is meant by the data type of a variable in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Which data type can store any data?

There is no such data type. However, when we use user-defined data types of our own type, then that type of data can be stored in a variable. So as a term, you may say that user-defined data type can store any data. As the data-type used in any variable will be depending upon us.


What is a valid variable data type?

1. If its natural or integer numbers- Integer(Int) data type. 2. If it consists of decimal or fraction part- Double or float data type. 3. If it has a single letter or sign- Character(Char) data type. 4. If its got many words(alpha-numerical)- String data type. 5. If the result has to be "true" or "false"- Boolean data type.


Which of the following is not a variable data type real integer number or string?

FILE, struct stat and struct tm are some examples.


What two things must you normally specify in a variable declaration?

This is when you specify the name and type of the variable.Example:int number;The declaration line can also include an instantiation for that variable.Example:int number = 5;When you declare a variable or an object (particularly in OOP programming) , you set aside a chunk of memory space for the data to reside.


What is variable in c plus plus programming?

You declare a variable by first defining its data type and then its name followed by a semi-colon. Here is an example: int variable; The example above declares an uninitialized integer variable. You can initialize the variable by giving it a value such as "int variable = 1;". It is important to initialize your variables, because you can get errors when executing your program that the variable does not have a value or is uninitialized. Variables that are uninitialized have whatever garbage value happens to be when the program is executed. Here are all of the data types that a variable can be: *int - integer value *char - character value *bool - boolean value

Related questions

What defines a data type?

the type of data which we store in a variable.. example: int a=10; /*here a is variable (data) which is of type int and stores a value 10.*/


Which data type can store any data?

There is no such data type. However, when we use user-defined data types of our own type, then that type of data can be stored in a variable. So as a term, you may say that user-defined data type can store any data. As the data-type used in any variable will be depending upon us.


What is the difference between Variable and Data Type of Variable?

Let's look at an example. int a = 1; Here our variable is 'a' which is of type 'int'


What is a valid variable data type?

1. If its natural or integer numbers- Integer(Int) data type. 2. If it consists of decimal or fraction part- Double or float data type. 3. If it has a single letter or sign- Character(Char) data type. 4. If its got many words(alpha-numerical)- String data type. 5. If the result has to be "true" or "false"- Boolean data type.


What type of data can line graphs display?

Line graphs are used to display data to show how one variable (the Responding variable) changes in response to another variable (the Manipulated variable).


Which of the following is not a variable data type real integer number or string?

FILE, struct stat and struct tm are some examples.


What is syntax in c plus plus for declaring a variable?

type variable {[optional array size]} {= optional initializer};


How much data can a global variable contain?

This question is meaningless. 'Variable' is not a type, and scope does not determine how much 'data' something can store.


What data or variable type is used for whole numbers?

int


What two things must you normally specify in a variable declaration?

This is when you specify the name and type of the variable.Example:int number;The declaration line can also include an instantiation for that variable.Example:int number = 5;When you declare a variable or an object (particularly in OOP programming) , you set aside a chunk of memory space for the data to reside.


What does Data types?

Data type means it tells the compiler the variable belongs to integer .character.floating.l


What is the difference between data and variable?

data type refers to the kind of value that is held by a particular variable. For ex: an int variable contains integer value, a string holds a alpha numeric value etc. variable refers to the name of a value using which we can refer to this value. Ex: public int age = 28; here int is the data type and age is the variable.