Which of the following is a valid identifier or variable?
1.well&1
2.well 1
3.well_1
4.@well
Answers
Answered by
2
Answer:
Explanation:
TRGF
WELL
WELL
3
4
5
Answered by
4
Identifiers :
Explanation:
- An identifier is a name that identifies (that is, labels the identity of) either a novel object or a singular class of objects, wherever the "object" or category may be a plan, physical numerable object (or category thereof), or physical noncountable substance (or category thereof).
- Identifiers are names given to different entities like constants, variables, structures, functions, etc.
- Example: int amount; double total balance; within the above example, amount and total balances are identifiers and int, and double are keywords.
The rules for the representation of identifier:
- A valid identifier must have letters (both uppercase and lowercase letters), digits, and underscores.
- The first letter of an identifier ought to be either a letter or an underscore.
- You can't use keywords like int, while etc. as identifiers.
- There is no rule on however long an identifier is.
According to the above rule, the valid identifier is well_1.
So the correct option is 3.
Similar questions