TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    C++

    C++ Intrinsic data types

    Overview

    C++ intrinsic data types are built into the language. These are also called primitive data types. There are several intrinsic datatypes that developers can declare and use the variables in the C++ programs.

    C++ Intrinsic Datatypes

    Some of the examples are as follows:

    • bool
    • char
    • int
    • float
    • double
    • void

    Based on the data type the operating system allocates memory for the variables.

    C++ Built-in Datatypes

    void no type
    bool boolean
    char character
    int integer
    float single-precision floating-point
    double double-precision floating-point
    wchat_t wide character type

     

    The below program displays the sizes of various primitive datatypes onto the console in bytes.

    C++ Program

    /************************************
    * C++ Intrinsic DataTypes
    * Filename: datatypes.cpp
    * C++ Tutorials - www.TestingDocs.com
    **************************************/
    #include 
    using namespace std;
    int main()
    {
     cout << "C++ Intrinsic DataTypes" << endl;
     cout << "Size void Datatype : " << sizeof(void) << " bytes "<<endl;
     cout << "Size bool Datatype : " << sizeof(bool) << " bytes "<<endl;
     cout << "Size char Datatype : " << sizeof(char) << " bytes "<<endl;
     cout << "Size int Datatype : " << sizeof(int) << " bytes "<<endl;
     cout << "Size float Datatype : " << sizeof(float) << " bytes "<<endl;
     cout << "Size double Datatype: " << sizeof(double) << " bytes "<<endl;
    
     return 0;
    } // end main

    Output

    C++ Intrinsic DataTypes
    Size void Datatype : 1 bytes
    Size bool Datatype : 1 bytes
    Size char Datatype : 1 bytes
    Size int Datatype : 4 bytes
    Size float Datatype : 4 bytes
    Size double Datatype: 8 bytes

     

    C++ Intrinsic Datatypes

     

    The sizeof() function returns the size of the data type passed to the function. For example, sizeof(char) returns 1. The units of the function are Bytes.

    —

    C++ Tutorials

    C++ Tutorials on this website:

    https://www.testingdocs.com/c-coding-tutorials/

    For more information on the current ISO C++ standard

    https://isocpp.org/std/the-standard

    Related Posts

    g not found OpenSuse

    C++ /

    Install GCC C++ Compiler on OpenSuse

    sum of digits c program

    C++ /

    Sum of Digits of a Number C++ Program

    C++ Hello World Program

    C++ /

    C++ Hello World Program

    C++ /

    Object-Oriented Programming Language Examples

    C++ /

    Object-Oriented Programming Features

    ‹ C++ Comments› C++ Input Statement

    Recent Posts

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com