Difference between Keyword and Identifier
Keywords: Keywords are specific reserved words in C each of which has a specific feature associated with it. Almost all of the words which help us use the functionality of the C language are included in the list of keywords. So you can imagine that the list of keywords is not going to be a small one! There are a total of 32 keywords in C:
auto break case char const continue
default do double else enum extern
float for goto if int long
register return short signed sizeof static
struct switch typedef union unsigned void
Identifiers: Identifiers are used as the general terminology for naming of variables, functions and arrays. These are user defined names consisting of arbitrarily long sequence of letters and digits with either a letter or the underscore(_) as a first character. Identifier names must differ in spelling and case from any keywords. You cannot use keywords as identifiers; they are reserved for special use. Once declared, you can use the identifier in later program statements to refer to the associated value. A special kind of identifier, called a statement label, can be used in goto statements. Difference between Keyword and Identifier:
|Keywords are predefined word that gets reserved for working program that have special meaning and cannot get used anywhere else.
|Identifiers are the values used to define different programming items such as variables, integers, structures, unions and others and mostly have an alphabetic character.
|Specify the type/kind of entity.
|Identify the name of a particular entity.
|It always starts with a lowercase letter.
|First character can be a uppercase, lowercase letter or underscore.
|A keyword should be in lower case.
|An identifier can be in upper case or lower case.
|A keyword contains only alphabetical characters.
|An identifier can consist of alphabetical characters, digits and underscores.
|They help to identify a specific property that exists within a computer language.
|They help to locate the name of the entity that gets defined along with a keyword.
|No special symbol, punctuation is used.
|No punctuation or special symbol except ‘underscore’ is used.
|Examples of keywords are: int, char, if, while, do, class etc.
|Examples of identifiers are: Test, count1, high_speed, etc.
Share your thoughts in the comments
Please Login to comment...