C++ Program to Find Size of int, float, double and char in Your System

In the following example of C++ program that determines the size (in bytes) of int, float, double, and char data types in your system :
Program :
#include <iostream>

int main() {
    std::cout << "Size of int: " << sizeof(int) << " bytes" << std::endl;
    std::cout << "Size of float: " << sizeof(float) << " bytes" << std::endl;
    std::cout << "Size of double: " << sizeof(double) << " bytes" << std::endl;
    std::cout << "Size of char: " << sizeof(char) << " bytes" << std::endl;
    return 0;
}
Output :
Size of int: 4 bytes
Size of float: 4 bytes
Size of double: 8 bytes
Size of char: 1 bytes
* This program uses the sizeof operator to determine the size of each data type in bytes. The std::cout object is used to print the results to the console.

* The endl manipulator is used to insert a newline character after each line of output. When you run this program, it should output the size of each data type in bytes on your system.