To add to what
Disch said above, the C language added types
char
(for a byte),
int
(for a machine word),
short int
(for a smaller integral type),
long int
(for a longer integral type), and
float
and
double
(for possible hardware supported floating point types) to its predecessor, a language called B.
long long
and
long double
were added to a later revision of the language to offer better support to more capable hardware.
Note there are no strings! These were hacked in with arrays of chars. So when you write:
The C language reserves 6 bytes and fills them with 'h', 'e', 'l', 'l', 'o', '\0'. The C runtime library has a whole bunch of functions that support this zero terminated (ASCIIZ) string;
strcat
,
strcpy
,
strcmp
, the
%s
in
printf
, and so on.
C++ inherited this stuff from C. But you really should use the standard string class. It avoid all the problems such as the you've run into.