C++ char type character variables

Description

C++ char type character variables

#include <iostream>
using namespace std;
int main()//from   w  w w. ja v a 2  s  . c  o  m
{
   char charvar1 = 'A';    //define char variable as character
   char charvar2 = '\t';   //define char variable as tab
   cout << charvar1;       //display character
   cout << charvar2;       //display character
   charvar1 = 'B';         //set char variable to char constant
   cout << charvar1;       //display character
   cout << '\n';           //display newline character
   return 0;
}



PreviousNext

Related