C++
C++
b. Floating-Point Types:
float: Single-precision floating-point data type.
double: Double-precision floating-point data type.
long double: Extended precision floating-point data type.
c. Character Types:
char: Character data type.
wchar_t: Wide character data type.
d. Boolean Type:
bool: Boolean data type, representing true or false.
a. Array:
Collection of elements of the same data type accessed using an index.
b. Pointer:
Holds the memory address of another variable.
c. Reference:
Provides an alias to an existing variable.
a. Struct:
Groups different data types under a single name.
b. Class:
Similar to a struct but can have member functions and access specifiers.
c. Union:
A special data type that can hold variables of different types but only one at a time.
d. Enumeration:
Allows you to define a type and specify the values it can take.
4. Void:
Represents the absence of a specific type.
#include <iostream>
int main() {
int age = 25;
float height = 5.9;
char grade = 'A';
bool isStudent = true;
return 0;
}
In this example, we've used integer, float, character, and boolean data types to store information about a
person's age, height, grade, and student status, respectively.