C++ Types


The type of a variable defines the contents of the variable. Every type es either:


There are just six common primitive types in C++

  • int stores integers
  • char stores single characters/single byte
  • bool stores a Boolean (true or false)
  • float stores a floating point number
  • double stores a double-precision floating point number
  • void denotes the absence of a value

An unbounded number of user-defined types can exist, here are some common user-defined types:

  • std::string a string (sequence of characters)
  • std::vectora dynamically-growing array