logo codesdope

In C++ Character is constant or variable?

   Sriya

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

  • variable
    - Wajih Wajih

Answers

  •    KalyanSrujan

    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

Write your answer
Close

Welcome.please sign up.

Close

Welcome.please login.