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.

Keywords  int,double ,struct,switch etc.

Identifiers  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.

5-NF form in DBMS

Keywords in C

Keywords are predefined, reserved  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 table

Following table represents the keywords in C. Here is a list of some identifiers given below
auto else long switch
break enum register typedef
case double return union
char float short unsigned
const for signed void
continue goto sizeof volatile
default if static while
do int struct _Packed

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.

for example

 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

Comparison Keyword 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.

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription