Tuesday 18 December 2018

Identifiers


Identifiers:

Identifiers refer to the names of the variables, functions and arrays. These are user defined names consists of a sequence of letters, digits and a special character i.e. _ (underscore). Rules for 

Identifiers : First character can be a letter or _ (underscore).

Underscore “ _ “ should not be used as an identifier alone. It should be within the alphabets.  

Identifiers must be from the character set.

Identifiers are case sensitive i.e. HAI, Hai and hai are three different identifiers.

Identifiers must not start with a digit, special character or a white space.

Hyphen ( - ) should not be used in an identifier.

Always avoid single character as an identifier.

Identifiers can be of any length, but the number of characters in a variable that are recognized by a compiler varies.  Cannot use keywords as an identifiers.


Ex :
Valid            Invalid
add               “add”
 num1           -num
 count_1       count-1

No comments:

Post a Comment