C Identifiers and Keywords in Programming Language

In this tutorial, you learn about identifiers and keywords in C programming and also learn about how identifier are used for name them. 

C Keywords

Keywords are reserved words having a special meaning in the programming language. A keyword is a type of token that is pre-defined words in a programming language that convey a special meaning to the compiler. 

Reserved words for special purposes so we cannot be used as variable names or as normal identifier names and it is wrong because by used keywords as variable names we are trying to assign a new meaning to the keyword whose pre-defined words in the programming language which is not allowed.
  • These are reserved words that are predefined in programming.
  • We can not use keywords as identifiers(variable names).
  • You cannot re-define keywords.

List of All 32 Keywords in C

auto
double
int
struct
break
else
long
switch
case
enum
register
typedef
char
extern
return
union
const
float
short
unsigned
continue
for
signed
void
default
goto
sizeof
volatile
do
if
static
while

C Identifier

The identifier is a fundamental building block and is used as the general terminology for names given to different parts of programs are variables, arrays, and functions. 

These C token are user-defined names consisting of an arbitrarily long sequence of digits and letters. The first character must be a letter (A-Z or a-z) or Underscore(_) and underscore is count as a letter. We cannot use C keywords as identifiers. These differ in spelling and if once we declared identifier it can be used in whole later program refer to the linked value.

Rules for identifiers in C

  1. The first character must be Letter(A-Z or a-z) or Underscore(_).
  2. You can not use any special symbol in identifier i.e. @,+,-,., etc.
  3. You can not use keywords as C identifiers.
  4. It should not contain any space between them.
  5. In the same program, two or more same identifiers are not possible.

valid and invalid identifiers in C


_file - Valid
MYDOB - Valid
MY.DOB - invalid because it contains a special symbol dot(.)
96file - invalid because the first character is a digit.
int - invalid because it is the C keywords.

For more C Token - identifiers and keywords in C

Related Posts

C Constants and Variables


Above article, Identifier and 
keywords in C programming, I think the whole article clear your doubt. In upcoming tutorials, I will share details of other C token.

Happy Coding 😊

If you have any doubts, Please let me know

Previous Post Next Post

Contact Form