Home Forums Programming Beginning C++ Reply To: Beginning C++

#42052
Anonymous
Inactive

The char type only holds a single letter, symbol or digit.

You can define a char that holds letter "a" for example but not more than one character at a time. To form words etc. you need to put individual chars together in a sequence called an array of chars like the following ["h","e","l","l","0",""].

Last array entry is special and called the nul character indicating that the sequence of chars is ended.

You can define such arrays of chars in C++ simply as follows
char greeting[] = "hello";

Java has a string type which is similar in effect to the above line.

You will find something like what I said in any book or on the web about programming.

Edit: Ah omen beat me