WalzoneInterview Prep
📞 Interviewing soon? Practice with a realistic AI mock phone interview — it calls you, then scores you. First 15 min FREE →

C++ · Basic · question 2 of 100

What are the basic data types in C++?

📕 Buy this interview preparation book: 100 C++ questions & answers — PDF + EPUB for $5

C++ provides several basic data types that allow you to store and manipulate different kinds of data. These data types can be broadly categorized into four groups: integral, floating-point, character, and boolean.

Integral types: These data types represent whole numbers, both positive and negative, without any fractional component. C++ provides the following integral data types:

Here’s an example of using some of the integral types in C++:

    #include <iostream>
    
    int main() {
        char myChar = 'a';
        short myShort = 42;
        int myInt = 12345;
        long myLong = 987654321;
        
        std::cout << "Char: " << myChar << std::endl;
        std::cout << "Short: " << myShort << std::endl;
        std::cout << "Int: " << myInt << std::endl;
        std::cout << "Long: " << myLong << std::endl;
        
        return 0;
    }

Floating-point types: These data types represent numbers with a fractional component. C++ provides two floating-point data types:

Here’s an example of using floating-point types in C++:

    #include <iostream>
    
    int main() {
        float myFloat = 3.1415f;
        double myDouble = 3.14159265358979323846;
        
        std::cout << "Float: " << myFloat << std::endl;
        std::cout << "Double: " << myDouble << std::endl;
        
        return 0;
    }

Character types: These data types represent single characters. C++ provides two character data types:

Here’s an example of using character types in C++:

    #include <iostream>
    
    int main() {
        char myChar = 'a';
        wchar_t myWideChar = L'';
        
        std::cout << "Char: " << myChar << std::endl;
        std::wcout << "Wide Char: " << myWideChar << std::endl;
        
        return 0;
    }
Reading is step one. Saying it out loud is the interview. Our AI interviewer calls your phone and runs a realistic C++ interview — then scores it.
📞 Practice C++ — free 15 min
📕 Buy this interview preparation book: 100 C++ questions & answers — PDF + EPUB for $5

All 100 C++ questions · All topics