Identifiers and keywords in C
Identifiers and Keywords
In this section, we will learn about the keywords, reversed words in the C programming tat are the part of the syntax. also we will learn about the identifiers and how to name them.
int,double ,struct,switch etc.
test,count, high, high_speed etc.
now we will study about identifiers and keywords in detail. we will see, how many keywords is there in C programming and all the rule for the select identifiers.
Keywords in C
Keywords are predefined, reversed words used in programming that have special meanings to compiler. Each keyword is meant to perform a specific function in a C program. Since keywords are referred name for compiler, they can not be used as variable name.
There are fixed number of Keyword in C programming language and every Keyword serve as a building block for program statements.
There are total 32 keywords in C keywords are written in lowercase letters..
Keywords tableFollowing table represents the keywords in C. Here is a list of some identifiers given below
Identifiers in C
Each program elements in a C program are given a name called identifiers. Name given to identity variable, functions and arrays are examples for identifiers.
identifiers must be unique. they are created to give a unique name to an entity to identify it during the execution of the program.
1 int square
2 double balance
3 function add()
Here, square , balance and add() are identifier. there are one thing that you should remember, identifier names must be different from keywords. you cannot use int as an identifier because int is keyword.
Rule for an identifier
- An identifier can only have alphanumeric characters (a-z, A-Z, 0-9) and underscore (_).
- The first character of an identifier can also contain alphabet (a-z, A-Z).
- Identifiers are also case sensitive in C. For example name and Name are two different identifiers in C.
- Keywords are not allowed to be used as identifiers.
- No special character, such as semicolon, period, white spaces, slash or comma are permitted to be used in or as identifiers.
Difference between Keyword and Identifier
|Basic||Keywords are the reversed words of a language.||Identifiers are the user defined names of variable, function and labels.|
|Use||Specify the Type/kind of entity.||Identify the name of particular entity.|
|Format||Consider only letters.||Consider letters, underscore, digits.|
|Case||Use only lower case.||Lower and upper case, both are allowed.|
|Symbol||No special Symbol, punctuation is used.||No punctuation or special symbol except ‘underscore’ is used.|
|Classifications||Keyword not further classified.||Identifiers are classified into external name and internal name.|
|Starting letter||It always starts with a lowercase latter.||First character can be a uppercase, lowercase letter or underscore.|