Character

The char data type is usually described as the data type that stores a character, however, this is not technically correct. The char data type stores a character as a numeric value based on the ASCII chart. When a char variable is defined, it can be defined with either the number that represents the character or the character itself as shown in the following code:

char myChar = 'A';
char myChar = 65;

In the preceding code, both lines declare a variable named myChar of the char type with a capital A as the value. Having a type that can hold only a single character is useful, but it would be more useful if we could store entire words or sentences. Later in this chapter, we will see how we can store words or sentences by using an array ...

Get Mastering Arduino now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.