> So my question is in what kind of situation would I apply other data types rather than just using int, float, char?
as the default integer type,
as the default floating point type,
as the default character type, and
as the default string type.
Consider using some other type in place of these only if there are externally imposed constraints that make
In particular, the logic that goes something like: 'an
can represent a maximum value of
, so if you want larger values, use
' is fundamentally unsound. At best, it provides a non-portable solution.
If you want fixed or minimum width integer types, use the types in <cstdint>
If you want a signed integer type that can hold 12 decimal digits, use something like:
decltype(999999999999) i = 0 ;