Identifiers and keywords in C

Identifiers and Keywords in C Language

identifiers-and-keywrods-in-c-language-gang-of-crypto

What is a identifier in C ?

Identifiers are names of a entities in C Language like arrays, functions, structures, unions and labels. There are certain rules to write an identifier.

Rules to write an identifier

  1. Any Identifier should begin with a-z/A-Z.
  2. Numbers are allowed in identifier only after the first character.
  3. No special symbols are allowed in the identifiers such as #,$,* etc.
  4. Spaces are not allowed in the identifiers.

Keywords in C Language

There are 32 keywords in C Language. These keywords are nothing but the special words which can be understood by the compiler at the time of execution. Keywords cannot be used as identifier.

Example: char is a keyword in C, Where it is understood by the compiler u that the value assigned to char is a character type.

KEYWORDS

  1. auto                                              17. registered          
  2. double                                          18. void
  3. int                                                  19. continue
  4. long                                               20. do
  5. break                                             21. if 
  6. switch                                            22. for
  7. char                                               23. signed
  8. extern                                            24. while
  9. return                                            25. static
  10. union                                             26. default
  11. case                                               27. Goto
  12. enum                                             28. sizeof
  13. registered                                     29. volatile
  14. typedef                                          30. const
  15. struct                                             31. unsigned
  16. else                                                 32. short

Difference between ‘Keyword’ and ‘Identifier’

Keyword:

  1. Keyword is a pre-defined word which must be written in lowercase only.
  2. It is known to the C compiler.
  3. These are used only for the intended purpose while the execution of program.

Identifier:

  1. Identifier is a user defined word which can be written in lowercase as well as uppercase.
  2. It is used for the developers and not known by the C compiler.
  3. It is preferred to have a meaningful identifier while writing a program.

What is a Variable

Variable:

A Variable is a name which holds the address of value stored in the memory. It is a temporary storage (like a container) to hold the data. To indicate the storage area, each variable must be given a unique name.

Rules to name a variable:

  1. The first letter of any variable must begin with a letter (or) underscore(_).
  2. Variable can have letters both uppercase and lowercase and digits in it.
  3. Length of variable can be any characters long without limit.

Note : If a variable is not assigned to any value, then it gives the garbage value as output by default in C Language. 

Referred from here