0
751views
What is an Identifier? Give any 5 rules that are to be followed, while declaring a variable.
1 Answer
0
28views

Identifiers are names given to different user defined things like variables, constants, functions, classes, objects, structures, unions, etc. While making these identifiers we need to follow some rules.

Rule for declaring a variable :-

  • The identifier can consist of alphabets, digits and a special symbol i.e. '_' (Underscore)
  • An identifier cannot start with a digit . It can start either with an alphabet or underscore.
  • It cannot contain special any special symbol except underscore. Blank spaces are also not allowed.
  • It can be a keyword.
  • It is case sensitive i.e. an alphabet capital in one identifier with same name in another identifier with that alphabet small case will be considered different.
  • Earlier, there was a limit of the length of the identifier to be 32 characters, but now this limit is removed. Hence, an identifier can be as long as required and minimum of one character.
Please log in to add an answer.