Home TechnologyComputers Subscribe to RSS

What Are The Variable And Rules For Writing Variable Names In C++?

Answer Question

1 Answer - Sort by: Date | Rating

    A quantity whose value may change during execution of the program is called variable. It is represented by a symbol or a name.
    A variable represents a storage or memory location in the computer memory. Data is stored into the memory location. The name of the memory location i.e. the variable name, remain fixed during execution of the program but the data stored in that location may change from time to time.

    Rules for writing variable names
    The following are the rules for writing variable name in a program in C++:
    1. The first character of variable name must be an alphabetic.
    2. Underscore can be used as first character of variable name.
    3. Blank spaces are not allowed in a variable name.
    4. Special characters such as arithmetic operators, #,^ can not be used in a variable. Reserved words cannot be used as variable names.
    5. The maximum length of a variable name depends upon the compiler of C++.
    6. A variable name declared for one data type cannot be used to declare another data type.
    7. C++ language is a case sensitive language. Thus variable names with same spelling but different cases are treated as different variable name e.g. A and a are two different variables.
    0 0

    Pretty123  

    answered 3 years ago

      More

      More

         
         

        Ask a Question via Twitter

        Send a question to @askblurtit and we will publish it online and send you a reply everytime you receive an answer.

        Blurtit Store

        Get T-shirts, hoodies, caps and more at the Blurtit store

        Blurtit International