+2 votes
in Class 11 by kratos

Write a short note on variables.

1 Answer

+3 votes
by kratos
 
Best answer

“A variable is a temporary container to store information, it is a named location in computer memory where varying data, like numbers and characters, can be stored and manipulated during the ***** of the program”.

A variable must be declared before it is used. For example, int my_age; A few naming conventions must be taken in consideration.

  1. It must start with an english alphabet character, either lowercase or uppercase, including underscore (not a hyphen). It may not start with a digit. The rest is optional. It can either be a letter or a digit (0-9).

  2. C++ keywords like main, case, class, if, else, do, while, for, tyedef, etc cannot be used as a variable names.

  3. It must be unique within the scope.

...