You are on page 1of 2

Variable Definition in C++:

   Variables  are a way of reserving memory to hold some data and assign names
to them so that we don't have to remember the numbers like 46735 and instead
we can use the memory location by simply referring to the variable.

Every variable is mapped to a unique memory address. For example, we


have 3 variable v1, v2, v3. They may be assigned the memory addresses 32000,
12456, 67893 respectively.

Variable Naming Conventions

 Variable names must start with a letter or underscore. By convention a


lower case letter.

 Then letters, numbers and the underscore can be used.

 Spaces are NOT allowed.

 Do NOT use any of the reserved keywords.

 Case is significant, num is a different variable to Num

 Only the first 31 characters are significant.

Tips in Naming Variables

 Names should be meaningful or descriptive.

 StudentAge or employee_age is more meaningful than “Age”, and much


more meaningful than a single letter variable like x.

 Spaces

 are either replaced by the underscore, e.g. “student num”

 or the space removed and the seconds name started with an uppercase
letter e.g. studentAdd.
When you’re done answer this on your browsers as an EXIT PASS

https://forms.gle/unYcvXPUfLyT1k7q8

thank you and have a nice weekend.

You might also like