Characters

  1. Any single character:
    char letter;

  2. Assignment:
    letter = 'X';
    cin >> letter;

  3. Internal representation: ASCII table.

  4. Conversion between int and char:
    int('A') = 65
    char(65) = 'A'

  5. How would you convert from character '2' to the integer 2?

  6. Escape sequences: \ causes the next character to be read literally.

    cout << "I said "no" and left"   //error!
    cout << "I said \"no\" and left" //fine

    The same:
       cout << "Hello" << endl;
       cout << "Hello\n";

    \n: newline
    \t: tab
    \a: bell