-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy path02-variable.c
More file actions
27 lines (20 loc) · 947 Bytes
/
02-variable.c
File metadata and controls
27 lines (20 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
What is a variable in programming?
In programming, a variable is a container (storage area) to hold data.
To indicate the storage area, each variable should be given
a unique name (identifier). Variable names are just the
symbolic representation of a memory location.
Rules for naming a variable
- A variable name can only have letters (both uppercase
and lowercase letters), digits and underscore.
- The first letter of a variable should be either a letter or an underscore.
- There is no rule on how long a variable name (identifier) can be.
However, you may run into problems in some compilers if the
variable name is longer than 31 characters.
Note: You should always try to give meaningful names to
variables. For example: firstName is a better variable name than fn.
In C, variable names should be preceded by a datatype,
to tell the compiler what type of data we storing in the variable.
Syntax -
datatype variableName = value;
*/