Close
Close

In C++ Character is constant or variable?

   Sriya

In c++ , whether the CHARACTER is a variable or a constant? 

  • variable
    - Wajih Wajih

Answers

  •   

    Hi Sriya,

    In C++ character is a variable

    Variable : Which can be changed.

    Constant : Which can not be changed.

    ex: program

     

    #include<iostream>

    int main()
    {
        using namespace std;
        
        char c;
        cout<<"Enter the char before Changing: ";
        cin>>c;
        cout <<"Thanks for entering the char: "<<c<<endl;
        cout<<"Enter the char after changing: ";
        cin>>c;
        cout <<"Thanks for entering the char: "<<c;
        return 0;
        
    }

     

     


    • Thank You!!
      - Sriya

Ask Yours
Post Yours
Write your answer