codegurukool.com · Free coding tutorials & online compiler

Home › C++ Tutorial › C++ data types

C++ data types

Sizes and kinds.

int, double, float, char, bool, string. Check sizes with sizeof.

Example code

#include <iostream>
using namespace std;
int main() {
  cout << sizeof(int) << " " << sizeof(double) << " " << sizeof(char) << " " << sizeof(bool) << endl;
  return 0;
}

Run this code in the online editor

← C++ user inputC++ operators and booleans →