A C variable cannot start with
Answers
A C variable cannot start with a number and a special symbol other than underscore.
What are the rules for variables in C language?
The rules for variables in C language are:
1. Variable name can start with a letter or underscore ( _ ) character only which means it cannot start with a number.
2. C is a case-sensitive language which means variable names are also case-sensitive.
Example - These three are different variables age, AGE, Age
3. Variable names can only have alphanumeric characters (A-Z, a-z, and 0-9) and underscore ( _ )
Variable can be short or long/descriptive.
Example - x, y, z, age, gender, Address, _var, etc.
Note - Variable names can't have whitespaces and variable names can't be a keyword that is reserved such as float, int, etc.
What is case sensitivity?
Case sensitivity is the term that tells us about the programming language capability of making out differences between Upper Case Letters and Lower Case Letters.
C language's variable cannot start with any numeric or special symbol except underscore(_).
The rules to be followed for the variables in C language,
- The first character should be an alphabet or underscore.
- The variable cannot start with any numeric or special symbol except underscore(_).
- The length of the variable cannot exceed 31 characters.
- It should not be a reserved keyword.
It is also known that the C language is case-sensitive. So it will differ in the uppercase and lowercase of the letters.