What are Datatypes in C++? What are modifiers in C++?
Datatype
A datatype is used to restrict the variable with the type of data to be stored. Hence, one can define datatype as a way to tell the variables to store a particular type of data.
A compiler permanently stores the variable according to its datatype because it assigns a particular amount of memory. Each datatype requires a different amount of memory. For a particular Operating System architecture, int stores 4 bytes of data and char stores 1 byte of data.
When you create a variable, the first question that comes to mind is what type of values I am going to store and use. Let say you want to store your name in a variable. Then you will use respective predefined datatypes like char. Similarly, if you want to store or compute numbers, you may use int, double, float, etc. So lets us see what datatypes are defined in Programming World.
Data-types are mainly classified into 3 types:
- Primitive Data Types: These data types are either built-in or predefined and are used directly while programming by the programmer. For example, int, char, float, bool, etc. These data types are available in ranges like:
- Integer
- Boolean
- Double Floating point
- Character
- Null
- Character
- Derived Data Types: These are made from the primitive or built-in datatype, they mainly ranges from function, array, pointer and References. For example,
int a = sum(a,b); // here sum is a derived data type.
3. User-Defined Data Types: These datatypes are defined by the user. These mainly consist of class, structure ( struct ), Union, TypeDef and Enumeration (Enum). These data types are used and defined according to the user requirements.
What Are Modifiers in Data Type?

As the name suggests, a modifier is used to modify the content. Similarly, Modifiers in Data Types are used to change the length of the data that a particular data type is made to hold. These are classified into four major types:
- Signed
- Unsigned
- Short
- Long