Rules for Constructing Variable Names: C

Rules for constructing variable names are same for all the data types.

Related Read:
Rules for Constructing int, float, char constants: C

Rules for Constructing Variable Names: C



YouTube Link: https://www.youtube.com/watch?v=sICsPcrZhQw [Watch the Video In Full Screen.]


Rules for constructing variable names

1. First character in a variable name must be an alphabet or an underscore( _ ).

2. Variable name can have alphabet, digits and underscore.

3. No commas, space allowed in variable name.

4. No other special symbols other than underscore is allowed.

5. C variables are case sensitive. Ex: name and Name are two different variables.

6. You can not use keywords / reserve words as variable name in C.

Valid Variable Names
_name
user_name
age20
iMac

Invalid Variable Names
9hundred
Micro soft
Apple$computers

Note: All these rules for constructing variable names apply for all the data types in C.